All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFCv2 0/3] make '%pD' print full path for file
@ 2021-05-28 11:39 Jia He
  2021-05-28 11:39 ` [PATCH RFCv2 1/3] fs: introduce helper d_path_fast() Jia He
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Jia He @ 2021-05-28 11:39 UTC (permalink / raw)
  To: Linus Torvalds, Petr Mladek, Steven Rostedt, Sergey Senozhatsky,
	Andy Shevchenko, Rasmus Villemoes, Jonathan Corbet,
	Alexander Viro, Luca Coelho, Kalle Valo, David S. Miller,
	Jakub Kicinski, Heiko Carstens, Vasily Gorbik
  Cc: Christian Borntraeger, Johannes Berg, linux-doc, linux-kernel,
	linux-wireless, netdev, linux-s390, Jia He

Background
==========
Linus suggested printing full path for file instead of printing
the components as '%pd'.

Typically, there is no need for printk specifiers to take any real locks
(ie mount_lock or rename_lock). So I introduce a new helper d_path_fast
which is similar to d_path except it doesn't take any seqlock/spinlock.

This series is based on Al Viro's d_path cleanup patches [1] which
lifted the inner lockless loop into a new helper. 

[1] https://lkml.org/lkml/2021/5/18/1260

Test
====
The cases I tested:
1. print '%pD' with full path of ext4 file
2. mount a ext4 filesystem upon a ext4 filesystem, and print the file
   with '%pD'
3. print file path which has more than 256 chars,"-ENAMETOOLONG" will
   be returned
4. print file path with '%32pD'
5. all test_print selftests
   
After this set, I found many lines containing '%pD[234]' should be changed
to '%pD'. I don't want to involve those subsystems in this patch series
before the helper is stable enough.
   
You can get the lines by:
$find fs/ -name \*.[ch] | xargs grep -rn "\%pD[234"

fs/overlayfs/file.c:65: pr_debug("open(%p[%pD2/%c], 0%o) -> (%p, 0%o)\n",
fs/nfs/direct.c:453:    dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
fs/nfs/direct.c:908:    dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n",
fs/nfs/write.c:1371:    dprintk("NFS:       nfs_updatepage(%pD2 %d@%lld)\n",
fs/nfs/nfs4file.c:116:  dprintk("NFS: flush(%pD2)\n", file);
fs/nfs/file.c:69:       dprintk("NFS: open file(%pD2)\n", filp);
fs/nfs/file.c:83:       dprintk("NFS: release(%pD2)\n", filp);
fs/nfs/file.c:117:      dprintk("NFS: llseek file(%pD2, %lld, %d)\n",
fs/nfs/file.c:145:      dprintk("NFS: flush(%pD2)\n", file);
fs/nfs/file.c:166:      dprintk("NFS: read(%pD2, %zu@%lu)\n",
fs/nfs/file.c:188:      dprintk("NFS: mmap(%pD2)\n", file);
fs/nfs/file.c:213:      dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync);
fs/nfs/file.c:328:      dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n",
fs/nfs/file.c:360:      dfprintk(PAGECACHE, "NFS: write_end(%pD2(%lu), %u@%lld)\n",
fs/nfs/file.c:551:      dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%lu), offset %lld)\n",
fs/nfs/file.c:621:      dprintk("NFS: write(%pD2, %zu@%Ld)\n",
fs/nfs/file.c:803:      dprintk("NFS: lock(%pD2, t=%x, fl=%x, r=%lld:%lld)\n",
fs/nfs/file.c:841:      dprintk("NFS: flock(%pD2, t=%x, fl=%x)\n",
fs/nfs/dir.c:111:       dfprintk(FILE, "NFS: open dir(%pD2)\n", filp);
fs/nfs/dir.c:456:                                               pr_notice("NFS: directory %pD2 contains a readdir loop."
fs/nfs/dir.c:1084:      dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n",
fs/nfs/dir.c:1158:      dfprintk(FILE, "NFS: readdir(%pD2) returns %d\n", file, res);
fs/nfs/dir.c:1166:      dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
fs/nfs/dir.c:1208:      dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
fs/nfsd/nfs4state.c:2439:         seq_printf(s, "filename: \"%pD2\"", f->nf_file);
fs/exec.c:817:          pr_warn_once("process '%pD4' started with executable stack\n",
fs/iomap/direct-io.c:429:               pr_warn_ratelimited("Direct I/O collision with buffered writes! File: %pD4 Comm: %.20s\n",
fs/ioctl.c:81:          pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n",
fs/read_write.c:425:            "kernel %s not supported for file %pD4 (pid: %d comm: %.20s)\n",
fs/splice.c:754:                "splice %s not supported for file %pD4 (pid: %d comm: %.20s)\n",
fs/afs/mntpt.c:64:      _enter("%p,%p{%pD2}", inode, file, file);

Changelog:
v2: 
- implement new d_path_fast based on Al Viro's patches
- add check_pointer check (by Petr)
- change the max full path size to 256 in stack space
v1: https://lkml.org/lkml/2021/5/8/122

Jia He (3):
  fs: introduce helper d_path_fast()
  lib/vsprintf.c: make %pD print full path for file
  s390/hmcdrv: remove the redundant directory path in debug message

 Documentation/core-api/printk-formats.rst |  5 +++--
 drivers/s390/char/hmcdrv_dev.c            | 10 +++++-----
 fs/d_path.c                               | 21 +++++++++++++++++++++
 include/linux/dcache.h                    |  1 +
 lib/vsprintf.c                            | 21 +++++++++++++++++----
 5 files changed, 47 insertions(+), 11 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [PATCH RFCv2 2/3] lib/vsprintf.c: make %pD print full path for file
@ 2021-05-29  0:26 kernel test robot
  0 siblings, 0 replies; 29+ messages in thread
From: kernel test robot @ 2021-05-29  0:26 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3697 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210528113951.6225-3-justin.he@arm.com>
References: <20210528113951.6225-3-justin.he@arm.com>
TO: Jia He <justin.he@arm.com>

Hi Jia,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linux/master]
[also build test WARNING on s390/features linus/master v5.13-rc3 next-20210528]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jia-He/make-pD-print-full-path-for-file/20210528-194137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: x86_64-randconfig-b001-20210527 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6505c630407c5feec818f0bb1c284f9eeebf2071)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # apt-get install iwyu # include-what-you-use
        # https://github.com/0day-ci/linux/commit/46d55769e0c29791bfb6709a1085ba8af749a71e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jia-He/make-pD-print-full-path-for-file/20210528-194137
        git checkout 46d55769e0c29791bfb6709a1085ba8af749a71e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross C=1 CHECK=iwyu ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


iwyu warnings: (new ones prefixed by >>)
   lib/vsprintf.c:52:1: iwyu: warning: superfluous #include <asm/byteorder.h>
   lib/vsprintf.c:51:1: iwyu: warning: superfluous #include <asm/page.h>
   lib/vsprintf.c:22:1: iwyu: warning: superfluous #include <linux/clk.h>
>> lib/vsprintf.c:35:1: iwyu: warning: superfluous #include <linux/dcache.h>
   lib/vsprintf.c:25:1: iwyu: warning: superfluous #include <linux/module.h>
   lib/vsprintf.c:37:1: iwyu: warning: superfluous #include <linux/rtc.h>
   lib/vsprintf.c:33:1: iwyu: warning: superfluous #include <linux/uaccess.h>

vim +35 lib/vsprintf.c

4b6ccca701ef59 Al Viro           2013-09-03 @35  #include <linux/dcache.h>
312b4e226951f7 Ryan Mallon       2013-11-12  36  #include <linux/cred.h>
4d42c44727a062 Andy Shevchenko   2018-12-04  37  #include <linux/rtc.h>
7daac5b2fdf88e Andy Shevchenko   2020-04-15  38  #include <linux/time.h>
2b1b0d66704a8c Andy Shevchenko   2016-05-20  39  #include <linux/uuid.h>
ce4fecf1fe1518 Pantelis Antoniou 2015-01-21  40  #include <linux/of.h>
8a27f7c90ffcb7 Joe Perches       2009-08-17  41  #include <net/addrconf.h>
ad67b74d2469d9 Tobin C. Harding  2017-11-01  42  #include <linux/siphash.h>
ad67b74d2469d9 Tobin C. Harding  2017-11-01  43  #include <linux/compiler.h>
a92eb7621b9fb2 Sakari Ailus      2019-10-03  44  #include <linux/property.h>
1031bc589228ca Dmitry Monakhov   2015-04-13  45  #ifdef CONFIG_BLOCK
1031bc589228ca Dmitry Monakhov   2015-04-13  46  #include <linux/blkdev.h>
1031bc589228ca Dmitry Monakhov   2015-04-13  47  #endif
^1da177e4c3f41 Linus Torvalds    2005-04-16  48  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32324 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2021-06-02  5:48 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 11:39 [PATCH RFCv2 0/3] make '%pD' print full path for file Jia He
2021-05-28 11:39 ` [PATCH RFCv2 1/3] fs: introduce helper d_path_fast() Jia He
2021-05-28 12:37   ` kernel test robot
2021-05-28 12:44   ` Al Viro
2021-05-28 12:51   ` Matthew Wilcox
2021-05-28 14:23     ` Justin He
2021-05-28 16:02   ` kernel test robot
2021-05-28 11:39 ` [PATCH RFCv2 2/3] lib/vsprintf.c: make %pD print full path for file Jia He
2021-05-28 12:59   ` Matthew Wilcox
2021-05-28 14:22     ` Justin He
2021-05-28 14:52       ` Matthew Wilcox
2021-05-28 15:09         ` Justin He
2021-05-28 15:22           ` Matthew Wilcox
2021-05-31  0:39             ` Justin He
2021-06-01 14:42             ` Justin He
2021-06-01 15:30               ` Matthew Wilcox
2021-06-01 15:36                 ` Andy Shevchenko
2021-06-01 15:44                   ` Matthew Wilcox
2021-06-01 15:53                     ` Andy Shevchenko
2021-06-01 16:10                       ` Andy Shevchenko
2021-06-01 17:05                         ` Matthew Wilcox
2021-06-01 19:01                           ` Rasmus Villemoes
2021-06-02  5:47                             ` Justin He
2021-05-28 20:06       ` Rasmus Villemoes
2021-05-30 15:18         ` Matthew Wilcox
2021-05-31  9:40           ` Petr Mladek
2021-05-30 20:51   ` kernel test robot
2021-05-28 11:39 ` [PATCH RFCv2 3/3] s390/hmcdrv: remove the redundant directory path in debug message Jia He
2021-05-29  0:26 [PATCH RFCv2 2/3] lib/vsprintf.c: make %pD print full path for file kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.