From ed389ce352db327117c85460e81767e2594cce7c Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Tue, 6 Jun 2023 10:44:53 +0700 Subject: [PATCH] LU-16314 llite: Migrate LASSERTF %p to %px This change covers lustre/ec through lustre/mgs and converts LASSERTF statements to explicitly use %px. Use %px to explicitly report the non-hashed pointer value messages printed when a kernel panic is imminent. When analyzing a crash dump the associated kernel address can be used to determine the system state that lead to the system crash. As crash dumps can and are provided by customers from production systems the use of the kernel command line parameter: no_hash_pointers is not always possible. Ref: Documentation/core-api/printk-formats.rst Test-Parameters: trivial HPE-bug-id: LUS-10945 Signed-off-by: Shaun Tancheff Change-Id: I708d9ef60c63f5b4006c7986599a2f39fc9e5fdf Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51213 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Petros Koutoupis Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/include/lustre_export.h | 18 ++++++++---------- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/ldlm/ldlm_request.c | 2 +- lustre/llite/file.c | 2 +- lustre/llite/llite_lib.c | 7 +++---- lustre/llite/rw.c | 2 +- lustre/llite/vvp_io.c | 4 ++-- lustre/lmv/lmv_obd.c | 2 +- lustre/lod/lod_dev.c | 2 +- lustre/mdc/mdc_dev.c | 4 ++-- lustre/mdc/mdc_locks.c | 2 +- lustre/mdc/mdc_request.c | 2 +- lustre/mdt/mdt_open.c | 2 +- 13 files changed, 24 insertions(+), 27 deletions(-) diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index de7efa7..8da3d579 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -157,16 +157,14 @@ struct nid_stat { exp_nid_stats */ }; -#define nidstat_getref(nidstat) \ -do { \ - atomic_inc(&(nidstat)->nid_exp_ref_count); \ -} while(0) - -#define nidstat_putref(nidstat) \ -do { \ - atomic_dec(&(nidstat)->nid_exp_ref_count); \ - LASSERTF(atomic_read(&(nidstat)->nid_exp_ref_count) >= 0, \ - "stat %p nid_exp_ref_count < 0\n", nidstat); \ +#define nidstat_getref(nidstat) \ + atomic_inc(&(nidstat)->nid_exp_ref_count) + +#define nidstat_putref(nidstat) \ +do { \ + atomic_dec(&(nidstat)->nid_exp_ref_count); \ + LASSERTF(atomic_read(&(nidstat)->nid_exp_ref_count) >= 0, \ + "stat %px nid_exp_ref_count < 0\n", nidstat); \ } while(0) enum obd_option { diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index fabb82d2..20985bd 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1562,7 +1562,7 @@ out: retry: buf = req_capsule_server_get(pill, &RMF_DLM_LVB); - LASSERTF(buf != NULL, "req %p, lock %p\n", req, lock); + LASSERTF(buf != NULL, "req %px, lock %px\n", req, lock); buflen = req_capsule_get_size(pill, &RMF_DLM_LVB, RCL_SERVER); /* diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 6fea124..e51cd98 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -2469,7 +2469,7 @@ static int ldlm_chain_lock_for_replay(struct ldlm_lock *lock, void *closure) /* we use l_pending_chain here, because it's unused on clients. */ LASSERTF(list_empty(&lock->l_pending_chain), - "lock %p next %p prev %p\n", + "lock %px next %px prev %px\n", lock, &lock->l_pending_chain.next, &lock->l_pending_chain.prev); /* diff --git a/lustre/llite/file.c b/lustre/llite/file.c index dcc8a93..10c03f3 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1012,7 +1012,7 @@ restart: GOTO(out_och_free, rc); LASSERTF(it_disposition(it, DISP_ENQ_OPEN_REF), - "inode %p: disposition %x, status %d\n", inode, + "inode %px: disposition %x, status %d\n", inode, it_disposition(it, ~0), it->it_status); rc = ll_local_open(file, it, fd, *och_p); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 7580a4c..c1253dd 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2811,8 +2811,7 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md) /* FID shouldn't be changed! */ if (fid_is_sane(&lli->lli_fid)) { LASSERTF(lu_fid_eq(&lli->lli_fid, &body->mbo_fid1), - "Trying to change FID "DFID - " to the "DFID", inode "DFID"(%p)\n", + "Trying to change FID "DFID" to the "DFID", inode "DFID"(%px)\n", PFID(&lli->lli_fid), PFID(&body->mbo_fid1), PFID(ll_inode2fid(inode)), inode); } else { @@ -3040,7 +3039,7 @@ void ll_truncate_inode_pages_final(struct inode *inode) unsigned long flags; LASSERTF((inode->i_state & I_FREEING) || inode_is_locked(inode), - DFID ":inode %p state %#lx, lli_flags %#lx\n", + DFID ":inode %px state %#lx, lli_flags %#lx\n", PFID(ll_inode2fid(inode)), inode, inode->i_state, ll_i2info(inode)->lli_flags); @@ -3089,7 +3088,7 @@ void ll_truncate_inode_pages_final(struct inode *inode) LASSERTF(!PageUptodate(page) && !PageDirty(page) && !PagePrivate(page), - "%p", page); + "%px", page); } rcu_read_unlock(); #endif diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 616b18a..c85b99b 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -473,7 +473,7 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io, page_idx, ra.cra_end_idx, ra.cra_rpc_pages); LASSERTF(ra.cra_end_idx >= page_idx, - "object: %p, indcies %lu / %lu\n", + "object: %px, indcies %lu / %lu\n", io->ci_obj, ra.cra_end_idx, page_idx); /* update read ahead RPC size. * NB: it's racy but doesn't matter */ diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index d07fefc..71c14ca 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1056,7 +1056,7 @@ static void vvp_set_pagevec_dirty(struct pagevec *pvec) BUILD_BUG_ON(PAGEVEC_SIZE > BITS_PER_LONG); LASSERTF(page->mapping, - "mapping must be set. page %p, page->private (cl_page) %p\n", + "mapping must be set. page %px, page->private (cl_page) %px\n", page, (void *) page->private); /* @@ -1107,7 +1107,7 @@ static void vvp_set_pagevec_dirty(struct pagevec *pvec) continue; LASSERTF(page->mapping == mapping, - "all pages must have the same mapping. page %p, mapping %p, first mapping %p\n", + "all pages must have the same mapping. page %px, mapping %px, first mapping %px\n", page, page->mapping, mapping); WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); ll_account_page_dirtied(page, mapping); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 3ede80c..f88cb73 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2801,7 +2801,7 @@ static struct lu_dirent *stripe_dirent_load(struct lmv_dir_ctxt *ctxt, /* @hash should be the last dirent hash */ LASSERTF(hash <= end, - "ctxt@%p stripe@%p hash %llx end %llx\n", + "ctxt@%px stripe@%px hash %llx end %llx\n", ctxt, stripe, hash, end); /* unload last page */ stripe_dirent_unload(stripe); diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index d6afa30..5354cfa 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -2168,7 +2168,7 @@ static struct lu_device *lod_device_free(const struct lu_env *env, lu_site_print(env, lu->ld_site, &lu->ld_ref, D_ERROR, lu_cdebug_printer); } - LASSERTF(atomic_read(&lu->ld_ref) == 0, "lu is %p\n", lu); + LASSERTF(atomic_read(&lu->ld_ref) == 0, "lu is %px\n", lu); dt_device_fini(&lod->lod_dt_dev); OBD_FREE_PTR(lod); RETURN(next); diff --git a/lustre/mdc/mdc_dev.c b/lustre/mdc/mdc_dev.c index b4ad623..cef8fdb 100644 --- a/lustre/mdc/mdc_dev.c +++ b/lustre/mdc/mdc_dev.c @@ -667,7 +667,7 @@ static int mdc_enqueue_interpret(const struct lu_env *env, * be valid. */ lock = ldlm_handle2lock(lockh); LASSERTF(lock != NULL, - "lockh %#llx, req %p, aa %p - client evicted?\n", + "lockh %#llx, req %px, aa %px - client evicted?\n", lockh->cookie, req, aa); /* Take an additional reference so that a blocking AST that @@ -870,7 +870,7 @@ static int mdc_lock_enqueue(const struct lu_env *env, ENTRY; LASSERTF(ergo(oscl->ols_glimpse, lock->cll_descr.cld_mode <= CLM_READ), - "lock = %p, ols = %p\n", lock, oscl); + "lock = %px, ols = %px\n", lock, oscl); if (oscl->ols_state == OLS_GRANTED) RETURN(0); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 12fd55c..09b8f6f 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -117,7 +117,7 @@ int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, struct inode *old_inode = lock->l_resource->lr_lvb_inode; LASSERTF(old_inode->i_state & I_FREEING, - "Found existing inode %p/%lu/%u state %lu in lock: setting data to %p/%lu/%u\n", + "Found existing inode %px/%lu/%u state %lu in lock: setting data to %px/%lu/%u\n", old_inode, old_inode->i_ino, old_inode->i_generation, old_inode->i_state, new_inode, new_inode->i_ino, new_inode->i_generation); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 5ecf780..af7ca89 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -919,7 +919,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, if (likely(mod != NULL)) { LASSERTF(mod->mod_open_req != NULL && mod->mod_open_req->rq_type != LI_POISON, - "POISONED open %p!\n", mod->mod_open_req); + "POISONED open %px!\n", mod->mod_open_req); mod->mod_close_req = req; diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 93f4e23..85f78fe 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -1312,7 +1312,7 @@ static int mdt_lock_root_xattr(struct mdt_thread_info *info, LASSERTF(mdt->mdt_md_root == md_root, "Different root object (" - DFID") instances, %p, %p\n", + DFID") instances, %px, %px\n", PFID(&info->mti_tmp_fid1), mdt->mdt_md_root, md_root); LASSERT(atomic_read( -- 1.8.3.1