Message ID | 20210824175108.19746-6-olga.kornievskaia@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | do not collapse trunkable transports | expand |
Hi Olga, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on nfs/linux-next] [also build test WARNING on v5.14-rc7 next-20210824] [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/Olga-Kornievskaia/do-not-collapse-trunkable-transports/20210825-020441 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: i386-randconfig-s001-20210824 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-348-gf0e6938b-dirty # https://github.com/0day-ci/linux/commit/9ac1118603b73fd71cf8746cd9a93ddefa97969c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Olga-Kornievskaia/do-not-collapse-trunkable-transports/20210825-020441 git checkout 9ac1118603b73fd71cf8746cd9a93ddefa97969c # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash net/sunrpc/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> net/sunrpc/clnt.c:2779:17: sparse: sparse: incompatible types in comparison expression (different address spaces): >> net/sunrpc/clnt.c:2779:17: sparse: char const [noderef] __rcu * >> net/sunrpc/clnt.c:2779:17: sparse: char const * vim +2779 net/sunrpc/clnt.c 2762 2763 /** 2764 * rpc_clnt_test_and_add_xprt - Test and add a new transport to a rpc_clnt 2765 * @clnt: pointer to struct rpc_clnt 2766 * @xps: pointer to struct rpc_xprt_switch, 2767 * @xprt: pointer struct rpc_xprt 2768 * @dummy: unused 2769 */ 2770 int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, 2771 struct rpc_xprt_switch *xps, struct rpc_xprt *xprt, 2772 void *dummy) 2773 { 2774 struct rpc_cb_add_xprt_calldata *data; 2775 struct rpc_task *task; 2776 2777 if (xps->xps_nunique_destaddr_xprts + 1 > clnt->cl_max_connect) { 2778 rcu_read_lock(); > 2779 pr_warn("SUNRPC: reached max allowed number (%d) did not add " 2780 "transport to server: %s\n", clnt->cl_max_connect, 2781 rcu_dereference(xprt->address_strings[RPC_DISPLAY_ADDR])); 2782 rcu_read_unlock(); 2783 return -EINVAL; 2784 } 2785 2786 data = kmalloc(sizeof(*data), GFP_NOFS); 2787 if (!data) 2788 return -ENOMEM; 2789 data->xps = xprt_switch_get(xps); 2790 data->xprt = xprt_get(xprt); 2791 if (rpc_xprt_switch_has_addr(data->xps, (struct sockaddr *)&xprt->addr)) { 2792 rpc_cb_add_xprt_release(data); 2793 goto success; 2794 } 2795 2796 task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC, 2797 &rpc_cb_add_xprt_call_ops, data); 2798 data->xps->xps_nunique_destaddr_xprts++; 2799 rpc_put_task(task); 2800 success: 2801 return 1; 2802 } 2803 EXPORT_SYMBOL_GPL(rpc_clnt_test_and_add_xprt); 2804 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 486dec59972b..23e165d5ec9c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -541,6 +541,7 @@ int nfs_create_rpc_client(struct nfs_client *clp, clnt->cl_principal = clp->cl_principal; clp->cl_rpcclient = clnt; + clnt->cl_max_connect = clp->cl_max_connect; return 0; } EXPORT_SYMBOL_GPL(nfs_create_rpc_client); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index b2edd5fc2f0c..a4661646adc9 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -82,6 +82,7 @@ struct rpc_clnt { struct work_struct cl_work; }; const struct cred *cl_cred; + unsigned int cl_max_connect; /* max number of transports not to the same IP */ }; /* @@ -136,6 +137,7 @@ struct rpc_create_args { char *client_name; struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ const struct cred *cred; + unsigned int max_connect; }; struct rpc_add_xprt_test { diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 451ac7d031db..05edb2d4b022 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2787,6 +2787,15 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, struct rpc_cb_add_xprt_calldata *data; struct rpc_task *task; + if (xps->xps_nunique_destaddr_xprts + 1 > clnt->cl_max_connect) { + rcu_read_lock(); + pr_warn("SUNRPC: reached max allowed number (%d) did not add " + "transport to server: %s\n", clnt->cl_max_connect, + rcu_dereference(xprt->address_strings[RPC_DISPLAY_ADDR])); + rcu_read_unlock(); + return -EINVAL; + } + data = kmalloc(sizeof(*data), GFP_NOFS); if (!data) return -ENOMEM;