Subject: linux-next: manual merge of the driver-core tree with the nfs tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 8 Jul 2019 18:44:02 +1000

Hi all,

Today's linux-next merge of the driver-core tree got a conflict in:

  net/sunrpc/debugfs.c

between commit:

  2f34b8bfae19 ("SUNRPC: add links for all client xprts to debugfs")

from the nfs tree and commit:

  0a0762c6c604 ("sunrpc: no need to check return value of debugfs_create functions")

from the driver-core tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc net/sunrpc/debugfs.c
index 105bea190a45,707d7aab1546..000000000000
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@@ -118,60 -117,40 +117,52 @@@ static const struct file_operations tas
  	.release	= tasks_release,
  };
  
 +static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *numv)
 +{
 +	int len;
 +	char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */
 +	char link[9]; /* enough for 8 hex digits + NULL */
 +	int *nump = numv;
 +
 +	if (IS_ERR_OR_NULL(xprt->debugfs))
 +		return 0;
 +	len = snprintf(name, sizeof(name), "../../rpc_xprt/%s",
 +		       xprt->debugfs->d_name.name);
 +	if (len > sizeof(name))
 +		return -1;
 +	if (*nump == 0)
 +		strcpy(link, "xprt");
 +	else {
 +		len = snprintf(link, sizeof(link), "xprt%d", *nump);
 +		if (len > sizeof(link))
 +			return -1;
 +	}
- 	if (!debugfs_create_symlink(link, clnt->cl_debugfs, name))
- 		return -1;
++	debugfs_create_symlink(link, clnt->cl_debugfs, name);
 +	(*nump)++;
 +	return 0;
 +}
 +
  void
  rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
  {
  	int len;
 -	char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */
 -	struct rpc_xprt *xprt;
 +	char name[9]; /* enough for 8 hex digits + NULL */
 +	int xprtnum = 0;
  
- 	/* Already registered? */
- 	if (clnt->cl_debugfs || !rpc_clnt_dir)
- 		return;
- 
  	len = snprintf(name, sizeof(name), "%x", clnt->cl_clid);
  	if (len >= sizeof(name))
  		return;
  
  	/* make the per-client dir */
  	clnt->cl_debugfs = debugfs_create_dir(name, rpc_clnt_dir);
- 	if (!clnt->cl_debugfs)
- 		return;
  
  	/* make tasks file */
- 	if (!debugfs_create_file("tasks", S_IFREG | 0400, clnt->cl_debugfs,
- 				 clnt, &tasks_fops))
- 		goto out_err;
+ 	debugfs_create_file("tasks", S_IFREG | 0400, clnt->cl_debugfs, clnt,
+ 			    &tasks_fops);
  
 -	rcu_read_lock();
 -	xprt = rcu_dereference(clnt->cl_xprt);
 -	/* no "debugfs" dentry? Don't bother with the symlink. */
 -	if (IS_ERR_OR_NULL(xprt->debugfs)) {
 -		rcu_read_unlock();
 -		return;
 -	}
 -	len = snprintf(name, sizeof(name), "../../rpc_xprt/%s",
 -			xprt->debugfs->d_name.name);
 -	rcu_read_unlock();
 -
 -	if (len >= sizeof(name))
 +	if (rpc_clnt_iterate_for_each_xprt(clnt, do_xprt_debugfs, &xprtnum) < 0)
  		goto out_err;
  
 -	debugfs_create_symlink("xprt", clnt->cl_debugfs, name);
 -
  	return;
  out_err:
  	debugfs_remove_recursive(clnt->cl_debugfs);