From: Shaun Tancheff Date: Thu, 24 Aug 2023 09:14:09 +0000 (-0500) Subject: LU-16314 llite: Prefer %pK with seq_printf X-Git-Tag: 2.15.59~176 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=bdb6033bf7351ff763ceee8b5cfeb7f5e4425ada;p=fs%2Flustre-release.git LU-16314 llite: Prefer %pK with seq_printf Update procfs and sysfs users to prefer %pK to when printing pointers so that when kptr_restrict is set to 1 a real pointer value is provided. To enable printing non-hashed pointer values: sysctl -w kernel/kptr_restrict=1 This change also sets kptr_restrict to 1 for all clients and servers under test by test framework. Test-Parameters: trivial HPE-bug-id: LUS-10945 Signed-off-by: Shaun Tancheff Change-Id: Iccfce1399648e752cb7b78afc75aacbfb0bde390 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51212 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/gnilnd/gnilnd_proc.c b/lnet/klnds/gnilnd/gnilnd_proc.c index c1e9c23..983d06e 100644 --- a/lnet/klnds/gnilnd/gnilnd_proc.c +++ b/lnet/klnds/gnilnd/gnilnd_proc.c @@ -492,7 +492,7 @@ kgnilnd_mdd_seq_show(struct seq_file *s, void *iter) hndl.qword1 = tx->tx_map_key.qword1; hndl.qword2 = tx->tx_map_key.qword2; - seq_printf(s, "%p %x %16llu %8d %#8x %#llx.%#llxx\n", + seq_printf(s, "%pK %x %16llu %8d %#8x %#llx.%#llxx\n", tx, id, nob, physnop, buftype, hndl.qword1, hndl.qword2); @@ -900,7 +900,7 @@ kgnilnd_conn_seq_show(struct seq_file *s, void *iter) read_unlock(&kgnilnd_data.kgn_peer_conn_lock); - seq_printf(s, "%p->%s [%d] q %d/%d/%d " + seq_printf(s, "%pK->%s [%d] q %d/%d/%d " "tx sq %u %dms/%dms " "rx sq %u %dms/%dms " "noop r/s %d/%d w/s/cq %lds/%lds/%lds " @@ -1021,16 +1021,7 @@ kgnilnd_proc_peer_conns_seq_show(struct seq_file *sf, void *v) list_for_each_entry(conn, &peer->gnp_conns, gnc_list) { seq_printf(sf, - "%04ld-%02d-%02dT%02d:%02d:%02d.%06ld %s " - "mbox adr %p " - "dg type %s " - "%s " - "purg %d " - "close s/r %d/%d " - "err %d peer err %d " - "tx sq %u %dms/%dms " - "rx sq %u %dms/%dms/%dms " - "tx retran %lld\n", + "%04ld-%02d-%02dT%02d:%02d:%02d.%06ld %s mbox adr %pK dg type %s %s purg %d close s/r %d/%d err %d peer err %d tx sq %u %dms/%dms rx sq %u %dms/%dms/%dms tx retran %lld\n", ctm.tm_year+1900, ctm.tm_mon+1, ctm.tm_mday, ctm.tm_hour, ctm.tm_min, ctm.tm_sec, now.tv_nsec, libcfs_nid2str(peer->gnp_nid), @@ -1263,7 +1254,7 @@ kgnilnd_peer_seq_show(struct seq_file *s, void *iter) read_unlock(&kgnilnd_data.kgn_peer_conn_lock); - seq_printf(s, "%p->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%lldms dgram %d@%dms reconn %dms to %lus \n", + seq_printf(s, "%pK->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%lldms dgram %d@%dms reconn %dms to %lus\n", peer, libcfs_nid2str(peer->gnp_nid), atomic_read(&peer->gnp_refcount), (peer->gnp_state == GNILND_PEER_DOWN) ? "down" : diff --git a/lustre/llite/vvp_dev.c b/lustre/llite/vvp_dev.c index 0217ce4..bc9779d 100644 --- a/lustre/llite/vvp_dev.c +++ b/lustre/llite/vvp_dev.c @@ -463,7 +463,7 @@ static void vvp_pgcache_page_show(const struct lu_env *env, int has_flags; vmpage = page->cp_vmpage; - seq_printf(seq, " %5i | %p %p %s %s | %p "DFID"(%p) %lu %u [", + seq_printf(seq, " %5i | %pK %pK %s %s | %pK "DFID"(%pK) %lu %u [", 0 /* gen */, NULL, /* was vvp_page */ page, diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b25fcb4..407474e 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -7042,8 +7042,15 @@ run_one_logged() { local zfs_debug_log=$TESTLOG_PREFIX.$TESTNAME.zfs_log local SAVE_UMASK=$(umask) local rc=0 + local node + declare -A kptr_restrict umask 0022 + for node in $(all_nodes); do + kptr_restrict[$node]=$(do_node $node "sysctl --values kernel/kptr_restrict") + do_node $node "sysctl -wq kernel/kptr_restrict=1" + done + rm -f $LOGDIR/err $LOGDIR/ignore $LOGDIR/skip echo # if $ONLY is set, repeat subtest $ONLY_REPEAT times, otherwise once @@ -7090,6 +7097,10 @@ run_one_logged() { [[ $rc != 0 || "$TEST_STATUS" != "PASS" ]] && break done + for node in $(all_nodes); do + do_node $node "sysctl -wq kernel/kptr_restrict=${kptr_restrict[$node]}" + done + if [[ "$TEST_STATUS" != "SKIP" && -f $TF_SKIP ]]; then rm -f $TF_SKIP fi