diff mbox series

sunrpc: Use no_printk() in dfprintk*() dummies

Message ID 707e5e6dd0db9a663cf443564d1f8ee1c10a0086.1697018818.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series sunrpc: Use no_printk() in dfprintk*() dummies | expand

Commit Message

Geert Uytterhoeven Oct. 11, 2023, 10:07 a.m. UTC
When building NFS with W=1 and CONFIG_WERROR=y, but
CONFIG_SUNRPC_DEBUG=n:

    fs/nfs/nfs4proc.c: In function ‘nfs4_proc_create_session’:
    fs/nfs/nfs4proc.c:9276:19: error: variable ‘ptr’ set but not used [-Werror=unused-but-set-variable]
     9276 |         unsigned *ptr;
	  |                   ^~~
      CC      fs/nfs/callback.o
    fs/nfs/callback.c: In function ‘nfs41_callback_svc’:
    fs/nfs/callback.c:98:13: error: variable ‘error’ set but not used [-Werror=unused-but-set-variable]
       98 |         int error;
	  |             ^~~~~
      CC      fs/nfs/flexfilelayout/flexfilelayout.o
    fs/nfs/flexfilelayout/flexfilelayout.c: In function ‘ff_layout_io_track_ds_error’:
    fs/nfs/flexfilelayout/flexfilelayout.c:1230:13: error: variable ‘err’ set but not used [-Werror=unused-but-set-variable]
     1230 |         int err;
	  |             ^~~
      CC      fs/nfs/flexfilelayout/flexfilelayoutdev.o
    fs/nfs/flexfilelayout/flexfilelayoutdev.c: In function ‘nfs4_ff_alloc_deviceid_node’:
    fs/nfs/flexfilelayout/flexfilelayoutdev.c:55:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
       55 |         int i, ret = -ENOMEM;
	  |                ^~~

All these are due to variables that are set uncontionally, but are used
only when debugging is enabled.

Fix this by changing the dfprintk*() dummy macros from empty loops to
calls to the no_printk() helper.  This informs the compiler that the
passed debug parameters are actually used, and enables format specifier
checking as a bonus.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 include/linux/sunrpc/debug.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Geert Uytterhoeven Oct. 11, 2023, 10:40 a.m. UTC | #1
On Wed, Oct 11, 2023 at 12:07 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> When building NFS with W=1 and CONFIG_WERROR=y, but
> CONFIG_SUNRPC_DEBUG=n:
>
>     fs/nfs/nfs4proc.c: In function ‘nfs4_proc_create_session’:
>     fs/nfs/nfs4proc.c:9276:19: error: variable ‘ptr’ set but not used [-Werror=unused-but-set-variable]
>      9276 |         unsigned *ptr;
>           |                   ^~~
>       CC      fs/nfs/callback.o
>     fs/nfs/callback.c: In function ‘nfs41_callback_svc’:
>     fs/nfs/callback.c:98:13: error: variable ‘error’ set but not used [-Werror=unused-but-set-variable]
>        98 |         int error;
>           |             ^~~~~
>       CC      fs/nfs/flexfilelayout/flexfilelayout.o
>     fs/nfs/flexfilelayout/flexfilelayout.c: In function ‘ff_layout_io_track_ds_error’:
>     fs/nfs/flexfilelayout/flexfilelayout.c:1230:13: error: variable ‘err’ set but not used [-Werror=unused-but-set-variable]
>      1230 |         int err;
>           |             ^~~
>       CC      fs/nfs/flexfilelayout/flexfilelayoutdev.o
>     fs/nfs/flexfilelayout/flexfilelayoutdev.c: In function ‘nfs4_ff_alloc_deviceid_node’:
>     fs/nfs/flexfilelayout/flexfilelayoutdev.c:55:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
>        55 |         int i, ret = -ENOMEM;
>           |                ^~~
>
> All these are due to variables that are set uncontionally, but are used
> only when debugging is enabled.
>
> Fix this by changing the dfprintk*() dummy macros from empty loops to
> calls to the no_printk() helper.  This informs the compiler that the
> passed debug parameters are actually used, and enables format specifier
> checking as a bonus.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  include/linux/sunrpc/debug.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
> index f6aeed07fe04e3d5..76539c6673f2fb15 100644
> --- a/include/linux/sunrpc/debug.h
> +++ b/include/linux/sunrpc/debug.h
> @@ -67,9 +67,9 @@ do {                                                                  \
>  # define RPC_IFDEBUG(x)                x
>  #else
>  # define ifdebug(fac)          if (0)
> -# define dfprintk(fac, fmt, ...)       do {} while (0)
> -# define dfprintk_cont(fac, fmt, ...)  do {} while (0)
> -# define dfprintk_rcu(fac, fmt, ...)   do {} while (0)
> +# define dfprintk(fac, fmt, ...)       no_printk(fmt, ##__VA_ARGS__)
> +# define dfprintk_cont(fac, fmt, ...)  no_printk(fmt, ##__VA_ARGS__)
> +# define dfprintk_rcu(fac, fmt, ...)   no_printk(fmt, ##__VA_ARGS__)
>  # define RPC_IFDEBUG(x)
>  #endif

Bummer, this is causing issues in fs/lockd/svclock.c
Will fix in v2.

Gr{oetje,eeting}s,

                        Geert
kernel test robot Oct. 12, 2023, 7:08 a.m. UTC | #2
Hi Geert,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.6-rc5 next-20231011]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/sunrpc-Use-no_printk-in-dfprintk-dummies/20231011-181013
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/707e5e6dd0db9a663cf443564d1f8ee1c10a0086.1697018818.git.geert%2Brenesas%40glider.be
patch subject: [PATCH] sunrpc: Use no_printk() in dfprintk*() dummies
config: alpha-defconfig (https://download.01.org/0day-ci/archive/20231012/202310121404.FMC1T6FF-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121404.FMC1T6FF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121404.FMC1T6FF-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:22,
                    from arch/alpha/include/asm/bug.h:23,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/alpha/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from fs/lockd/svclock.c:25:
   fs/lockd/svclock.c: In function 'nlmsvc_lookup_block':
>> fs/lockd/svclock.c:164:33: error: implicit declaration of function 'nlmdbg_cookie2a' [-Werror=implicit-function-declaration]
     164 |                                 nlmdbg_cookie2a(&block->b_call->a_args.cookie));
         |                                 ^~~~~~~~~~~~~~~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/lockd/svclock.c:160:17: note: in expansion of macro 'dprintk'
     160 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
         |                 ^~~~~~~
>> fs/lockd/svclock.c:160:25: warning: format '%s' expects argument of type 'char *', but argument 7 has type 'int' [-Wformat=]
     160 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ......
     164 |                                 nlmdbg_cookie2a(&block->b_call->a_args.cookie));
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                 |
         |                                 int
   include/linux/printk.h:427:25: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ^~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/lockd/svclock.c:160:17: note: in expansion of macro 'dprintk'
     160 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
         |                 ^~~~~~~
   fs/lockd/svclock.c:160:72: note: format string is defined here
     160 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
         |                                                                       ~^
         |                                                                        |
         |                                                                        char *
         |                                                                       %d
   fs/lockd/svclock.c: In function 'nlmsvc_find_block':
   fs/lockd/svclock.c:203:17: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
     203 |         dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~
         |                                                      |
         |                                                      int
   include/linux/printk.h:427:25: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ^~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/lockd/svclock.c:203:9: note: in expansion of macro 'dprintk'
     203 |         dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block);
         |         ^~~~~~~
   fs/lockd/svclock.c:203:37: note: format string is defined here
     203 |         dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block);
         |                                    ~^
         |                                     |
         |                                     char *
         |                                    %d
   fs/lockd/svclock.c: In function 'nlmsvc_lock':
   fs/lockd/svclock.c:494:33: error: 'inode' undeclared (first use in this function)
     494 |                                 inode->i_sb->s_id, inode->i_ino,
         |                                 ^~~~~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/lockd/svclock.c:493:9: note: in expansion of macro 'dprintk'
     493 |         dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
         |         ^~~~~~~
   fs/lockd/svclock.c:494:33: note: each undeclared identifier is reported only once for each function it appears in
     494 |                                 inode->i_sb->s_id, inode->i_ino,
         |                                 ^~~~~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/lockd/svclock.c:493:9: note: in expansion of macro 'dprintk'
     493 |         dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
         |         ^~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/asm-generic/bug.h:22,
                    from arch/alpha/include/asm/bug.h:23,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/current.h:6,
                    from ./arch/alpha/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/sunrpc/svcauth_gss.h:12,
                    from fs/nfsd/nfsfh.c:13:
   fs/nfsd/nfsfh.c: In function 'nfsd_setuser_and_check_port':
>> fs/nfsd/nfsfh.c:111:47: error: 'buf' undeclared (first use in this function)
     111 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:110:17: note: in expansion of macro 'dprintk'
     110 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~
   fs/nfsd/nfsfh.c:111:47: note: each undeclared identifier is reported only once for each function it appears in
     111 |                         svc_print_addr(rqstp, buf, sizeof(buf)));
         |                                               ^~~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfsd/nfsfh.c:110:17: note: in expansion of macro 'dprintk'
     110 |                 dprintk("nfsd: request from insecure port %s!\n",
         |                 ^~~~~~~


vim +/nlmdbg_cookie2a +164 fs/lockd/svclock.c

5a0e3ad6af8660 Tejun Heo            2010-03-24  @25  #include <linux/slab.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   26  #include <linux/errno.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   27  #include <linux/kernel.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   28  #include <linux/sched.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   29  #include <linux/sunrpc/clnt.h>
5ccb0066f2d561 Stanislav Kinsbursky 2012-07-25   30  #include <linux/sunrpc/svc_xprt.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   31  #include <linux/lockd/nlm.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   32  #include <linux/lockd/lockd.h>
d751a7cd069555 Jeff Layton          2008-02-07   33  #include <linux/kthread.h>
b840be2f00c0bc J. Bruce Fields      2021-08-20   34  #include <linux/exportfs.h>
^1da177e4c3f41 Linus Torvalds       2005-04-16   35  
^1da177e4c3f41 Linus Torvalds       2005-04-16   36  #define NLMDBG_FACILITY		NLMDBG_SVCLOCK
^1da177e4c3f41 Linus Torvalds       2005-04-16   37  
^1da177e4c3f41 Linus Torvalds       2005-04-16   38  #ifdef CONFIG_LOCKD_V4
^1da177e4c3f41 Linus Torvalds       2005-04-16   39  #define nlm_deadlock	nlm4_deadlock
^1da177e4c3f41 Linus Torvalds       2005-04-16   40  #else
^1da177e4c3f41 Linus Torvalds       2005-04-16   41  #define nlm_deadlock	nlm_lck_denied
^1da177e4c3f41 Linus Torvalds       2005-04-16   42  #endif
^1da177e4c3f41 Linus Torvalds       2005-04-16   43  
6849c0cab69f5d Trond Myklebust      2006-03-20   44  static void nlmsvc_release_block(struct nlm_block *block);
^1da177e4c3f41 Linus Torvalds       2005-04-16   45  static void	nlmsvc_insert_block(struct nlm_block *block, unsigned long);
68a2d76cea4234 Olaf Kirch           2006-10-04   46  static void	nlmsvc_remove_block(struct nlm_block *block);
963d8fe5333912 Trond Myklebust      2006-01-03   47  
5e1abf8cb713a0 Trond Myklebust      2006-03-20   48  static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock);
5e1abf8cb713a0 Trond Myklebust      2006-03-20   49  static void nlmsvc_freegrantargs(struct nlm_rqst *call);
963d8fe5333912 Trond Myklebust      2006-01-03   50  static const struct rpc_call_ops nlmsvc_grant_ops;
^1da177e4c3f41 Linus Torvalds       2005-04-16   51  
^1da177e4c3f41 Linus Torvalds       2005-04-16   52  /*
^1da177e4c3f41 Linus Torvalds       2005-04-16   53   * The list of blocked locks to retry
^1da177e4c3f41 Linus Torvalds       2005-04-16   54   */
68a2d76cea4234 Olaf Kirch           2006-10-04   55  static LIST_HEAD(nlm_blocked);
f904be9cc77f36 Bryan Schumaker      2010-09-21   56  static DEFINE_SPINLOCK(nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds       2005-04-16   57  
10b89567db51e1 Jeff Layton          2014-11-17   58  #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
ffa94db6042e6f Trond Myklebust      2012-03-20   59  static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
ffa94db6042e6f Trond Myklebust      2012-03-20   60  {
ffa94db6042e6f Trond Myklebust      2012-03-20   61  	/*
3c5199143bc4b3 Jeff Layton          2015-01-22   62  	 * We can get away with a static buffer because this is only called
3c5199143bc4b3 Jeff Layton          2015-01-22   63  	 * from lockd, which is single-threaded.
ffa94db6042e6f Trond Myklebust      2012-03-20   64  	 */
ffa94db6042e6f Trond Myklebust      2012-03-20   65  	static char buf[2*NLM_MAXCOOKIELEN+1];
ffa94db6042e6f Trond Myklebust      2012-03-20   66  	unsigned int i, len = sizeof(buf);
ffa94db6042e6f Trond Myklebust      2012-03-20   67  	char *p = buf;
ffa94db6042e6f Trond Myklebust      2012-03-20   68  
ffa94db6042e6f Trond Myklebust      2012-03-20   69  	len--;	/* allow for trailing \0 */
ffa94db6042e6f Trond Myklebust      2012-03-20   70  	if (len < 3)
ffa94db6042e6f Trond Myklebust      2012-03-20   71  		return "???";
ffa94db6042e6f Trond Myklebust      2012-03-20   72  	for (i = 0 ; i < cookie->len ; i++) {
ffa94db6042e6f Trond Myklebust      2012-03-20   73  		if (len < 2) {
ffa94db6042e6f Trond Myklebust      2012-03-20   74  			strcpy(p-3, "...");
ffa94db6042e6f Trond Myklebust      2012-03-20   75  			break;
ffa94db6042e6f Trond Myklebust      2012-03-20   76  		}
ffa94db6042e6f Trond Myklebust      2012-03-20   77  		sprintf(p, "%02x", cookie->data[i]);
ffa94db6042e6f Trond Myklebust      2012-03-20   78  		p += 2;
ffa94db6042e6f Trond Myklebust      2012-03-20   79  		len -= 2;
ffa94db6042e6f Trond Myklebust      2012-03-20   80  	}
ffa94db6042e6f Trond Myklebust      2012-03-20   81  	*p = '\0';
ffa94db6042e6f Trond Myklebust      2012-03-20   82  
ffa94db6042e6f Trond Myklebust      2012-03-20   83  	return buf;
ffa94db6042e6f Trond Myklebust      2012-03-20   84  }
ffa94db6042e6f Trond Myklebust      2012-03-20   85  #endif
ffa94db6042e6f Trond Myklebust      2012-03-20   86  
^1da177e4c3f41 Linus Torvalds       2005-04-16   87  /*
^1da177e4c3f41 Linus Torvalds       2005-04-16   88   * Insert a blocked lock into the global list
^1da177e4c3f41 Linus Torvalds       2005-04-16   89   */
^1da177e4c3f41 Linus Torvalds       2005-04-16   90  static void
f904be9cc77f36 Bryan Schumaker      2010-09-21   91  nlmsvc_insert_block_locked(struct nlm_block *block, unsigned long when)
^1da177e4c3f41 Linus Torvalds       2005-04-16   92  {
68a2d76cea4234 Olaf Kirch           2006-10-04   93  	struct nlm_block *b;
68a2d76cea4234 Olaf Kirch           2006-10-04   94  	struct list_head *pos;
^1da177e4c3f41 Linus Torvalds       2005-04-16   95  
^1da177e4c3f41 Linus Torvalds       2005-04-16   96  	dprintk("lockd: nlmsvc_insert_block(%p, %ld)\n", block, when);
68a2d76cea4234 Olaf Kirch           2006-10-04   97  	if (list_empty(&block->b_list)) {
6849c0cab69f5d Trond Myklebust      2006-03-20   98  		kref_get(&block->b_count);
68a2d76cea4234 Olaf Kirch           2006-10-04   99  	} else {
68a2d76cea4234 Olaf Kirch           2006-10-04  100  		list_del_init(&block->b_list);
68a2d76cea4234 Olaf Kirch           2006-10-04  101  	}
68a2d76cea4234 Olaf Kirch           2006-10-04  102  
68a2d76cea4234 Olaf Kirch           2006-10-04  103  	pos = &nlm_blocked;
^1da177e4c3f41 Linus Torvalds       2005-04-16  104  	if (when != NLM_NEVER) {
^1da177e4c3f41 Linus Torvalds       2005-04-16  105  		if ((when += jiffies) == NLM_NEVER)
^1da177e4c3f41 Linus Torvalds       2005-04-16  106  			when ++;
68a2d76cea4234 Olaf Kirch           2006-10-04  107  		list_for_each(pos, &nlm_blocked) {
68a2d76cea4234 Olaf Kirch           2006-10-04  108  			b = list_entry(pos, struct nlm_block, b_list);
68a2d76cea4234 Olaf Kirch           2006-10-04  109  			if (time_after(b->b_when,when) || b->b_when == NLM_NEVER)
68a2d76cea4234 Olaf Kirch           2006-10-04  110  				break;
68a2d76cea4234 Olaf Kirch           2006-10-04  111  		}
68a2d76cea4234 Olaf Kirch           2006-10-04  112  		/* On normal exit from the loop, pos == &nlm_blocked,
68a2d76cea4234 Olaf Kirch           2006-10-04  113  		 * so we will be adding to the end of the list - good
68a2d76cea4234 Olaf Kirch           2006-10-04  114  		 */
68a2d76cea4234 Olaf Kirch           2006-10-04  115  	}
^1da177e4c3f41 Linus Torvalds       2005-04-16  116  
68a2d76cea4234 Olaf Kirch           2006-10-04  117  	list_add_tail(&block->b_list, pos);
^1da177e4c3f41 Linus Torvalds       2005-04-16  118  	block->b_when = when;
^1da177e4c3f41 Linus Torvalds       2005-04-16  119  }
^1da177e4c3f41 Linus Torvalds       2005-04-16  120  
f904be9cc77f36 Bryan Schumaker      2010-09-21  121  static void nlmsvc_insert_block(struct nlm_block *block, unsigned long when)
f904be9cc77f36 Bryan Schumaker      2010-09-21  122  {
f904be9cc77f36 Bryan Schumaker      2010-09-21  123  	spin_lock(&nlm_blocked_lock);
f904be9cc77f36 Bryan Schumaker      2010-09-21  124  	nlmsvc_insert_block_locked(block, when);
f904be9cc77f36 Bryan Schumaker      2010-09-21  125  	spin_unlock(&nlm_blocked_lock);
f904be9cc77f36 Bryan Schumaker      2010-09-21  126  }
f904be9cc77f36 Bryan Schumaker      2010-09-21  127  
^1da177e4c3f41 Linus Torvalds       2005-04-16  128  /*
^1da177e4c3f41 Linus Torvalds       2005-04-16  129   * Remove a block from the global list
^1da177e4c3f41 Linus Torvalds       2005-04-16  130   */
68a2d76cea4234 Olaf Kirch           2006-10-04  131  static inline void
^1da177e4c3f41 Linus Torvalds       2005-04-16  132  nlmsvc_remove_block(struct nlm_block *block)
^1da177e4c3f41 Linus Torvalds       2005-04-16  133  {
f904be9cc77f36 Bryan Schumaker      2010-09-21  134  	spin_lock(&nlm_blocked_lock);
be2be5f7f44364 Alexander Aring      2023-07-20  135  	if (!list_empty(&block->b_list)) {
68a2d76cea4234 Olaf Kirch           2006-10-04  136  		list_del_init(&block->b_list);
f904be9cc77f36 Bryan Schumaker      2010-09-21  137  		spin_unlock(&nlm_blocked_lock);
6849c0cab69f5d Trond Myklebust      2006-03-20  138  		nlmsvc_release_block(block);
be2be5f7f44364 Alexander Aring      2023-07-20  139  		return;
^1da177e4c3f41 Linus Torvalds       2005-04-16  140  	}
be2be5f7f44364 Alexander Aring      2023-07-20  141  	spin_unlock(&nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds       2005-04-16  142  }
^1da177e4c3f41 Linus Torvalds       2005-04-16  143  
^1da177e4c3f41 Linus Torvalds       2005-04-16  144  /*
d9f6eb75d49007 Trond Myklebust      2006-03-20  145   * Find a block for a given lock
^1da177e4c3f41 Linus Torvalds       2005-04-16  146   */
^1da177e4c3f41 Linus Torvalds       2005-04-16  147  static struct nlm_block *
d9f6eb75d49007 Trond Myklebust      2006-03-20  148  nlmsvc_lookup_block(struct nlm_file *file, struct nlm_lock *lock)
^1da177e4c3f41 Linus Torvalds       2005-04-16  149  {
68a2d76cea4234 Olaf Kirch           2006-10-04  150  	struct nlm_block	*block;
^1da177e4c3f41 Linus Torvalds       2005-04-16  151  	struct file_lock	*fl;
^1da177e4c3f41 Linus Torvalds       2005-04-16  152  
^1da177e4c3f41 Linus Torvalds       2005-04-16  153  	dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %Ld-%Ld ty=%d\n",
^1da177e4c3f41 Linus Torvalds       2005-04-16  154  				file, lock->fl.fl_pid,
^1da177e4c3f41 Linus Torvalds       2005-04-16  155  				(long long)lock->fl.fl_start,
^1da177e4c3f41 Linus Torvalds       2005-04-16  156  				(long long)lock->fl.fl_end, lock->fl.fl_type);
be2be5f7f44364 Alexander Aring      2023-07-20  157  	spin_lock(&nlm_blocked_lock);
68a2d76cea4234 Olaf Kirch           2006-10-04  158  	list_for_each_entry(block, &nlm_blocked, b_list) {
92737230dd3f14 Trond Myklebust      2006-03-20  159  		fl = &block->b_call->a_args.lock.fl;
^1da177e4c3f41 Linus Torvalds       2005-04-16 @160  		dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
^1da177e4c3f41 Linus Torvalds       2005-04-16  161  				block->b_file, fl->fl_pid,
^1da177e4c3f41 Linus Torvalds       2005-04-16  162  				(long long)fl->fl_start,
^1da177e4c3f41 Linus Torvalds       2005-04-16  163  				(long long)fl->fl_end, fl->fl_type,
92737230dd3f14 Trond Myklebust      2006-03-20 @164  				nlmdbg_cookie2a(&block->b_call->a_args.cookie));
^1da177e4c3f41 Linus Torvalds       2005-04-16  165  		if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) {
6849c0cab69f5d Trond Myklebust      2006-03-20  166  			kref_get(&block->b_count);
be2be5f7f44364 Alexander Aring      2023-07-20  167  			spin_unlock(&nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds       2005-04-16  168  			return block;
^1da177e4c3f41 Linus Torvalds       2005-04-16  169  		}
^1da177e4c3f41 Linus Torvalds       2005-04-16  170  	}
be2be5f7f44364 Alexander Aring      2023-07-20  171  	spin_unlock(&nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds       2005-04-16  172  
^1da177e4c3f41 Linus Torvalds       2005-04-16  173  	return NULL;
^1da177e4c3f41 Linus Torvalds       2005-04-16  174  }
^1da177e4c3f41 Linus Torvalds       2005-04-16  175
kernel test robot Oct. 12, 2023, 10:06 a.m. UTC | #3
Hi Geert,

kernel test robot noticed the following build errors:

[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.6-rc5 next-20231012]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/sunrpc-Use-no_printk-in-dfprintk-dummies/20231011-181013
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/707e5e6dd0db9a663cf443564d1f8ee1c10a0086.1697018818.git.geert%2Brenesas%40glider.be
patch subject: [PATCH] sunrpc: Use no_printk() in dfprintk*() dummies
config: parisc64-defconfig (https://download.01.org/0day-ci/archive/20231012/202310121759.0CF34DcN-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121759.0CF34DcN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121759.0CF34DcN-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:30,
                    from include/linux/uio.h:8,
                    from include/linux/socket.h:8,
                    from include/uapi/linux/in.h:25,
                    from include/linux/in.h:19,
                    from include/linux/nfs_fs.h:22,
                    from fs/nfs/filelayout/filelayout.c:32:
   fs/nfs/filelayout/filelayout.c: In function 'filelayout_reset_write':
>> fs/nfs/filelayout/filelayout.c:96:34: error: 'struct rpc_task' has no member named 'tk_pid'
      96 |                         hdr->task.tk_pid,
         |                                  ^
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/filelayout/filelayout.c:94:17: note: in expansion of macro 'dprintk'
      94 |                 dprintk("%s Reset task %5u for i/o through MDS "
         |                 ^~~~~~~
   fs/nfs/filelayout/filelayout.c: In function 'filelayout_reset_read':
   fs/nfs/filelayout/filelayout.c:113:34: error: 'struct rpc_task' has no member named 'tk_pid'
     113 |                         hdr->task.tk_pid,
         |                                  ^
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/filelayout/filelayout.c:111:17: note: in expansion of macro 'dprintk'
     111 |                 dprintk("%s Reset task %5u for i/o through MDS "
         |                 ^~~~~~~
   fs/nfs/filelayout/filelayout.c: In function 'filelayout_read_prepare':
   fs/nfs/filelayout/filelayout.c:277:71: error: 'struct rpc_task' has no member named 'tk_pid'
     277 |                 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
         |                                                                       ^~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/filelayout/filelayout.c:277:17: note: in expansion of macro 'dprintk'
     277 |                 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
         |                 ^~~~~~~
   fs/nfs/filelayout/filelayout.c: In function 'filelayout_write_prepare':
   fs/nfs/filelayout/filelayout.c:375:71: error: 'struct rpc_task' has no member named 'tk_pid'
     375 |                 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
         |                                                                       ^~
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/filelayout/filelayout.c:375:17: note: in expansion of macro 'dprintk'
     375 |                 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
         |                 ^~~~~~~
--
   In file included from include/linux/kernel.h:30,
                    from include/linux/uio.h:8,
                    from include/linux/socket.h:8,
                    from include/uapi/linux/in.h:25,
                    from include/linux/in.h:19,
                    from include/linux/nfs_fs.h:22,
                    from fs/nfs/flexfilelayout/flexfilelayout.c:10:
   fs/nfs/flexfilelayout/flexfilelayout.c: In function 'ff_layout_reset_write':
>> fs/nfs/flexfilelayout/flexfilelayout.c:1020:34: error: 'struct rpc_task' has no member named 'tk_pid'
    1020 |                         hdr->task.tk_pid,
         |                                  ^
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/flexfilelayout/flexfilelayout.c:1018:17: note: in expansion of macro 'dprintk'
    1018 |                 dprintk("%s Reset task %5u for i/o through pNFS "
         |                 ^~~~~~~
   fs/nfs/flexfilelayout/flexfilelayout.c:1033:34: error: 'struct rpc_task' has no member named 'tk_pid'
    1033 |                         hdr->task.tk_pid,
         |                                  ^
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/flexfilelayout/flexfilelayout.c:1031:17: note: in expansion of macro 'dprintk'
    1031 |                 dprintk("%s Reset task %5u for i/o through MDS "
         |                 ^~~~~~~
   fs/nfs/flexfilelayout/flexfilelayout.c: In function 'ff_layout_reset_read':
   fs/nfs/flexfilelayout/flexfilelayout.c:1069:34: error: 'struct rpc_task' has no member named 'tk_pid'
    1069 |                         hdr->task.tk_pid,
         |                                  ^
   include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: in expansion of macro 'printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                 ^~~~~~
   include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                         ^~~~~~~~~
   include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~
   fs/nfs/flexfilelayout/flexfilelayout.c:1067:17: note: in expansion of macro 'dprintk'
    1067 |                 dprintk("%s Reset task %5u for i/o through MDS "
         |                 ^~~~~~~


vim +96 fs/nfs/filelayout/filelayout.c

7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20  @32  #include <linux/nfs_fs.h>
19345cb299e823 fs/nfs/nfs4filelayout.c        Benny Halevy          2011-06-19   33  #include <linux/nfs_page.h>
143cb494cb6662 fs/nfs/nfs4filelayout.c        Paul Gortmaker        2011-07-01   34  #include <linux/module.h>
66114cad64bf76 fs/nfs/filelayout/filelayout.c Tejun Heo             2015-05-22   35  #include <linux/backing-dev.h>
16b374ca439fb4 fs/nfs/nfs4filelayout.c        Andy Adamson          2010-10-20   36  
0a702195234eb7 fs/nfs/nfs4filelayout.c        Weston Andros Adamson 2012-02-17   37  #include <linux/sunrpc/metrics.h>
0a702195234eb7 fs/nfs/nfs4filelayout.c        Weston Andros Adamson 2012-02-17   38  
b5968725f46d95 fs/nfs/filelayout/filelayout.c Tom Haynes            2014-05-12   39  #include "../nfs4session.h"
b5968725f46d95 fs/nfs/filelayout/filelayout.c Tom Haynes            2014-05-12   40  #include "../internal.h"
b5968725f46d95 fs/nfs/filelayout/filelayout.c Tom Haynes            2014-05-12   41  #include "../delegation.h"
b5968725f46d95 fs/nfs/filelayout/filelayout.c Tom Haynes            2014-05-12   42  #include "filelayout.h"
b5968725f46d95 fs/nfs/filelayout/filelayout.c Tom Haynes            2014-05-12   43  #include "../nfs4trace.h"
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   44  
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   45  #define NFSDBG_FACILITY         NFSDBG_PNFS_LD
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   46  
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   47  MODULE_LICENSE("GPL");
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   48  MODULE_AUTHOR("Dean Hildebrand <dhildebz@umich.edu>");
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   49  MODULE_DESCRIPTION("The NFSv4 file layout driver");
7ab672ce312133 fs/nfs/nfs4filelayout.c        Dean Hildebrand       2010-10-20   50  
cbdabc7f8bf14c fs/nfs/nfs4filelayout.c        Andy Adamson          2011-03-01   51  #define FILELAYOUT_POLL_RETRY_MAX     (15*HZ)
9c455a8c1e146d fs/nfs/filelayout/filelayout.c Trond Myklebust       2020-03-21   52  static const struct pnfs_commit_ops filelayout_commit_ops;
cbdabc7f8bf14c fs/nfs/nfs4filelayout.c        Andy Adamson          2011-03-01   53  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   54  static loff_t
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   55  filelayout_get_dense_offset(struct nfs4_filelayout_segment *flseg,
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   56  			    loff_t offset)
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   57  {
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   58  	u32 stripe_width = flseg->stripe_unit * flseg->dsaddr->stripe_count;
3476f114addb7b fs/nfs/nfs4filelayout.c        Chris Metcalf         2011-08-11   59  	u64 stripe_no;
3476f114addb7b fs/nfs/nfs4filelayout.c        Chris Metcalf         2011-08-11   60  	u32 rem;
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   61  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   62  	offset -= flseg->pattern_offset;
3476f114addb7b fs/nfs/nfs4filelayout.c        Chris Metcalf         2011-08-11   63  	stripe_no = div_u64(offset, stripe_width);
3476f114addb7b fs/nfs/nfs4filelayout.c        Chris Metcalf         2011-08-11   64  	div_u64_rem(offset, flseg->stripe_unit, &rem);
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   65  
3476f114addb7b fs/nfs/nfs4filelayout.c        Chris Metcalf         2011-08-11   66  	return stripe_no * flseg->stripe_unit + rem;
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   67  }
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   68  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   69  /* This function is used by the layout driver to calculate the
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   70   * offset of the file on the dserver based on whether the
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   71   * layout type is STRIPE_DENSE or STRIPE_SPARSE
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   72   */
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   73  static loff_t
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   74  filelayout_get_dserver_offset(struct pnfs_layout_segment *lseg, loff_t offset)
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   75  {
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   76  	struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   77  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   78  	switch (flseg->stripe_type) {
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   79  	case STRIPE_SPARSE:
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   80  		return offset;
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   81  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   82  	case STRIPE_DENSE:
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   83  		return filelayout_get_dense_offset(flseg, offset);
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   84  	}
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   85  
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   86  	BUG();
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   87  }
cfe7f4120f8b1b fs/nfs/nfs4filelayout.c        Fred Isaman           2011-03-01   88  
d45f60c67848b9 fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09   89  static void filelayout_reset_write(struct nfs_pgio_header *hdr)
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27   90  {
d45f60c67848b9 fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09   91  	struct rpc_task *task = &hdr->task;
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27   92  
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27   93  	if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27   94  		dprintk("%s Reset task %5u for i/o through MDS "
1e8968c5b05823 fs/nfs/nfs4filelayout.c        Niels de Vos          2013-12-17   95  			"(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
d45f60c67848b9 fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09  @96  			hdr->task.tk_pid,
497826af60f812 fs/nfs/nfs4filelayout.c        Bryan Schumaker       2012-05-22   97  			hdr->inode->i_sb->s_id,
1e8968c5b05823 fs/nfs/nfs4filelayout.c        Niels de Vos          2013-12-17   98  			(unsigned long long)NFS_FILEID(hdr->inode),
d45f60c67848b9 fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09   99  			hdr->args.count,
d45f60c67848b9 fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09  100  			(unsigned long long)hdr->args.offset);
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27  101  
53113ad35e4b9c fs/nfs/filelayout/filelayout.c Weston Andros Adamson 2014-06-09  102  		task->tk_status = pnfs_write_done_resend_to_mds(hdr);
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27  103  	}
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27  104  }
e7dd79af01e7ca fs/nfs/nfs4filelayout.c        Andy Adamson          2012-04-27  105
Geert Uytterhoeven Oct. 12, 2023, 10:11 a.m. UTC | #4
On Thu, Oct 12, 2023 at 9:09 AM kernel test robot <lkp@intel.com> wrote:
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on trondmy-nfs/linux-next]
> [also build test ERROR on linus/master v6.6-rc5 next-20231011]
> [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#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/sunrpc-Use-no_printk-in-dfprintk-dummies/20231011-181013
> base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
> patch link:    https://lore.kernel.org/r/707e5e6dd0db9a663cf443564d1f8ee1c10a0086.1697018818.git.geert%2Brenesas%40glider.be
> patch subject: [PATCH] sunrpc: Use no_printk() in dfprintk*() dummies
> config: alpha-defconfig (https://download.01.org/0day-ci/archive/20231012/202310121404.FMC1T6FF-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121404.FMC1T6FF-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202310121404.FMC1T6FF-lkp@intel.com/
>
> All error/warnings (new ones prefixed by >>):
>
>    In file included from include/asm-generic/bug.h:22,
>                     from arch/alpha/include/asm/bug.h:23,
>                     from include/linux/bug.h:5,
>                     from include/linux/thread_info.h:13,
>                     from include/asm-generic/preempt.h:5,
>                     from ./arch/alpha/include/generated/asm/preempt.h:1,
>                     from include/linux/preempt.h:79,
>                     from include/linux/spinlock.h:56,
>                     from include/linux/mmzone.h:8,
>                     from include/linux/gfp.h:7,
>                     from include/linux/slab.h:16,
>                     from fs/lockd/svclock.c:25:
>    fs/lockd/svclock.c: In function 'nlmsvc_lookup_block':
> >> fs/lockd/svclock.c:164:33: error: implicit declaration of function 'nlmdbg_cookie2a' [-Werror=implicit-function-declaration]
>      164 |                                 nlmdbg_cookie2a(&block->b_call->a_args.cookie));
>          |                                 ^~~~~~~~~~~~~~~
>    include/linux/printk.h:427:33: note: in definition of macro 'printk_index_wrap'
>      427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
>          |                                 ^~~~~~~~~~~
>    include/linux/printk.h:129:17: note: in expansion of macro 'printk'
>      129 |                 printk(fmt, ##__VA_ARGS__);             \
>          |                 ^~~~~~
>    include/linux/sunrpc/debug.h:70:41: note: in expansion of macro 'no_printk'
>       70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
>          |                                         ^~~~~~~~~
>    include/linux/sunrpc/debug.h:25:9: note: in expansion of macro 'dfprintk'
>       25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
>          |         ^~~~~~~~
>    fs/lockd/svclock.c:160:17: note: in expansion of macro 'dprintk'
>      160 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
>          |                 ^~~~~~~
> >> fs/lockd/svclock.c:160:25: warning: format '%s' expects argument of type 'char *', but argument 7 has type 'int' [-Wformat=]

Thanks already fixed in v2.

Gr{oetje,eeting}s,

                        Geert
kernel test robot Oct. 12, 2023, 10:59 a.m. UTC | #5
Hi Geert,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on linus/master v6.6-rc5 next-20231012]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/sunrpc-Use-no_printk-in-dfprintk-dummies/20231011-181013
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/707e5e6dd0db9a663cf443564d1f8ee1c10a0086.1697018818.git.geert%2Brenesas%40glider.be
patch subject: [PATCH] sunrpc: Use no_printk() in dfprintk*() dummies
config: powerpc-ebony_defconfig (https://download.01.org/0day-ci/archive/20231012/202310121849.fnsB0A2T-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121849.fnsB0A2T-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121849.fnsB0A2T-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/lockd/svclock.c:164:5: error: call to undeclared function 'nlmdbg_cookie2a'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     164 |                                 nlmdbg_cookie2a(&block->b_call->a_args.cookie));
         |                                 ^
>> fs/lockd/svclock.c:164:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
     164 |                 dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
         |                                                                       ~~
         |                                                                       %d
     165 |                                 block->b_file, fl->fl_pid,
     166 |                                 (long long)fl->fl_start,
     167 |                                 (long long)fl->fl_end, fl->fl_type,
     168 |                                 nlmdbg_cookie2a(&block->b_call->a_args.cookie));
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/sunrpc/debug.h:25:28: note: expanded from macro 'dprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |                            ~~~    ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:70:51: note: expanded from macro 'dfprintk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                                   ~~~    ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: expanded from macro 'no_printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                        ~~~    ^~~~~~~~~~~
   include/linux/printk.h:455:60: note: expanded from macro 'printk'
     455 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:427:19: note: expanded from macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
   fs/lockd/svclock.c:203:47: error: call to undeclared function 'nlmdbg_cookie2a'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     203 |         dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block);
         |                                                      ^
   fs/lockd/svclock.c:203:47: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
     203 |         dprintk("nlmsvc_find_block(%s): block=%p\n", nlmdbg_cookie2a(cookie), block);
         |                                    ~~                ^~~~~~~~~~~~~~~~~~~~~~~
         |                                    %d
   include/linux/sunrpc/debug.h:25:28: note: expanded from macro 'dprintk'
      25 |         dfprintk(FACILITY, fmt, ##__VA_ARGS__)
         |                            ~~~    ^~~~~~~~~~~
   include/linux/sunrpc/debug.h:70:51: note: expanded from macro 'dfprintk'
      70 | # define dfprintk(fac, fmt, ...)        no_printk(fmt, ##__VA_ARGS__)
         |                                                   ~~~    ^~~~~~~~~~~
   include/linux/printk.h:129:17: note: expanded from macro 'no_printk'
     129 |                 printk(fmt, ##__VA_ARGS__);             \
         |                        ~~~    ^~~~~~~~~~~
   include/linux/printk.h:455:60: note: expanded from macro 'printk'
     455 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:427:19: note: expanded from macro 'printk_index_wrap'
     427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
   fs/lockd/svclock.c:494:5: error: use of undeclared identifier 'inode'
     494 |                                 inode->i_sb->s_id, inode->i_ino,
         |                                 ^
   fs/lockd/svclock.c:494:24: error: use of undeclared identifier 'inode'
     494 |                                 inode->i_sb->s_id, inode->i_ino,
         |                                                    ^
   2 warnings and 4 errors generated.


vim +164 fs/lockd/svclock.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  143  
^1da177e4c3f41 Linus Torvalds  2005-04-16  144  /*
d9f6eb75d49007 Trond Myklebust 2006-03-20  145   * Find a block for a given lock
^1da177e4c3f41 Linus Torvalds  2005-04-16  146   */
^1da177e4c3f41 Linus Torvalds  2005-04-16  147  static struct nlm_block *
d9f6eb75d49007 Trond Myklebust 2006-03-20  148  nlmsvc_lookup_block(struct nlm_file *file, struct nlm_lock *lock)
^1da177e4c3f41 Linus Torvalds  2005-04-16  149  {
68a2d76cea4234 Olaf Kirch      2006-10-04  150  	struct nlm_block	*block;
^1da177e4c3f41 Linus Torvalds  2005-04-16  151  	struct file_lock	*fl;
^1da177e4c3f41 Linus Torvalds  2005-04-16  152  
^1da177e4c3f41 Linus Torvalds  2005-04-16  153  	dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %Ld-%Ld ty=%d\n",
^1da177e4c3f41 Linus Torvalds  2005-04-16  154  				file, lock->fl.fl_pid,
^1da177e4c3f41 Linus Torvalds  2005-04-16  155  				(long long)lock->fl.fl_start,
^1da177e4c3f41 Linus Torvalds  2005-04-16  156  				(long long)lock->fl.fl_end, lock->fl.fl_type);
be2be5f7f44364 Alexander Aring 2023-07-20  157  	spin_lock(&nlm_blocked_lock);
68a2d76cea4234 Olaf Kirch      2006-10-04  158  	list_for_each_entry(block, &nlm_blocked, b_list) {
92737230dd3f14 Trond Myklebust 2006-03-20  159  		fl = &block->b_call->a_args.lock.fl;
^1da177e4c3f41 Linus Torvalds  2005-04-16  160  		dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%s\n",
^1da177e4c3f41 Linus Torvalds  2005-04-16  161  				block->b_file, fl->fl_pid,
^1da177e4c3f41 Linus Torvalds  2005-04-16  162  				(long long)fl->fl_start,
^1da177e4c3f41 Linus Torvalds  2005-04-16  163  				(long long)fl->fl_end, fl->fl_type,
92737230dd3f14 Trond Myklebust 2006-03-20 @164  				nlmdbg_cookie2a(&block->b_call->a_args.cookie));
^1da177e4c3f41 Linus Torvalds  2005-04-16  165  		if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) {
6849c0cab69f5d Trond Myklebust 2006-03-20  166  			kref_get(&block->b_count);
be2be5f7f44364 Alexander Aring 2023-07-20  167  			spin_unlock(&nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds  2005-04-16  168  			return block;
^1da177e4c3f41 Linus Torvalds  2005-04-16  169  		}
^1da177e4c3f41 Linus Torvalds  2005-04-16  170  	}
be2be5f7f44364 Alexander Aring 2023-07-20  171  	spin_unlock(&nlm_blocked_lock);
^1da177e4c3f41 Linus Torvalds  2005-04-16  172  
^1da177e4c3f41 Linus Torvalds  2005-04-16  173  	return NULL;
^1da177e4c3f41 Linus Torvalds  2005-04-16  174  }
^1da177e4c3f41 Linus Torvalds  2005-04-16  175
diff mbox series

Patch

diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index f6aeed07fe04e3d5..76539c6673f2fb15 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -67,9 +67,9 @@  do {									\
 # define RPC_IFDEBUG(x)		x
 #else
 # define ifdebug(fac)		if (0)
-# define dfprintk(fac, fmt, ...)	do {} while (0)
-# define dfprintk_cont(fac, fmt, ...)	do {} while (0)
-# define dfprintk_rcu(fac, fmt, ...)	do {} while (0)
+# define dfprintk(fac, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
+# define dfprintk_cont(fac, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
+# define dfprintk_rcu(fac, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
 # define RPC_IFDEBUG(x)
 #endif