All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Some cleanups and updates for sunrpc
@ 2017-02-07 13:44 Kinglong Mee
  2017-02-07 13:46 ` [PATCH 1/7] sunrpc: error out if register_shrinker fail Kinglong Mee
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:44 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

The first one is an bugfix of checking register_shrinker's result,
the following sixes are codes cleanup and updates.

Kinglong Mee (7):
  sunrpc: error out if register_shrinker fail
  sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail
  sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix
  sunrpc: remove dead codes of cr_magic in rpc_cred
  sunrpc: update the comments of sunrpc proc path
  sunrpc: record rpc client pointer in seq->private directly
  sunrpc: use simple_read_from_buffer for reading cache flush

 fs/nfs/cache_lib.c           |  3 +-
 include/linux/sunrpc/auth.h  |  6 +---
 include/linux/sunrpc/cache.h | 15 ++--------
 net/sunrpc/auth.c            |  9 +++---
 net/sunrpc/auth_null.c       |  3 --
 net/sunrpc/auth_unix.c       | 18 ++++++------
 net/sunrpc/cache.c           | 68 ++++++++++++++------------------------------
 net/sunrpc/debugfs.c         | 35 +++++++----------------
 net/sunrpc/svcauth_unix.c    |  4 +--
 9 files changed, 52 insertions(+), 109 deletions(-)

-- 
2.9.3



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

* [PATCH 1/7] sunrpc: error out if register_shrinker fail
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
@ 2017-02-07 13:46 ` Kinglong Mee
  2017-02-07 13:47 ` [PATCH 2/7] sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail Kinglong Mee
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:46 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

register_shrinker may return error when register fail, error out.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 net/sunrpc/auth.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index a7d03ea..4aa6ef1 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -873,8 +873,12 @@ int __init rpcauth_init_module(void)
 	err = rpc_init_generic_auth();
 	if (err < 0)
 		goto out2;
-	register_shrinker(&rpc_cred_shrinker);
+	err = register_shrinker(&rpc_cred_shrinker);
+	if (err < 0)
+		goto out3;
 	return 0;
+out3:
+	rpc_destroy_generic_auth();
 out2:
 	rpc_destroy_authunix();
 out1:
-- 
2.9.3


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

* [PATCH 2/7] sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
  2017-02-07 13:46 ` [PATCH 1/7] sunrpc: error out if register_shrinker fail Kinglong Mee
@ 2017-02-07 13:47 ` Kinglong Mee
  2017-02-07 13:48 ` [PATCH 3/7] sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix Kinglong Mee
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:47 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust

Record flush/channel/content entries is useless, remove them.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/cache_lib.c           |  3 +--
 include/linux/sunrpc/cache.h | 15 +++-----------
 net/sunrpc/cache.c           | 49 +++++++++++++++-----------------------------
 3 files changed, 21 insertions(+), 46 deletions(-)

diff --git a/fs/nfs/cache_lib.c b/fs/nfs/cache_lib.c
index 6de1570..2ae676f 100644
--- a/fs/nfs/cache_lib.c
+++ b/fs/nfs/cache_lib.c
@@ -141,8 +141,7 @@ int nfs_cache_register_net(struct net *net, struct cache_detail *cd)
 
 void nfs_cache_unregister_sb(struct super_block *sb, struct cache_detail *cd)
 {
-	if (cd->u.pipefs.dir)
-		sunrpc_cache_unregister_pipefs(cd);
+	sunrpc_cache_unregister_pipefs(cd);
 }
 
 void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 62a60ee..bb5c9c8 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -63,15 +63,6 @@ struct cache_head {
 
 #define	CACHE_NEW_EXPIRY 120	/* keep new things pending confirmation for 120 seconds */
 
-struct cache_detail_procfs {
-	struct proc_dir_entry	*proc_ent;
-	struct proc_dir_entry   *flush_ent, *channel_ent, *content_ent;
-};
-
-struct cache_detail_pipefs {
-	struct dentry *dir;
-};
-
 struct cache_detail {
 	struct module *		owner;
 	int			hash_size;
@@ -123,9 +114,9 @@ struct cache_detail {
 	time_t			last_warn;		/* when we last warned about no readers */
 
 	union {
-		struct cache_detail_procfs procfs;
-		struct cache_detail_pipefs pipefs;
-	} u;
+		struct proc_dir_entry	*procfs;
+		struct dentry		*pipefs;
+	};
 	struct net		*net;
 };
 
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 8147e8d..688ef8c 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1600,21 +1600,12 @@ static const struct file_operations cache_flush_operations_procfs = {
 	.llseek		= no_llseek,
 };
 
-static void remove_cache_proc_entries(struct cache_detail *cd, struct net *net)
+static void remove_cache_proc_entries(struct cache_detail *cd)
 {
-	struct sunrpc_net *sn;
-
-	if (cd->u.procfs.proc_ent == NULL)
-		return;
-	if (cd->u.procfs.flush_ent)
-		remove_proc_entry("flush", cd->u.procfs.proc_ent);
-	if (cd->u.procfs.channel_ent)
-		remove_proc_entry("channel", cd->u.procfs.proc_ent);
-	if (cd->u.procfs.content_ent)
-		remove_proc_entry("content", cd->u.procfs.proc_ent);
-	cd->u.procfs.proc_ent = NULL;
-	sn = net_generic(net, sunrpc_net_id);
-	remove_proc_entry(cd->name, sn->proc_net_rpc);
+	if (cd->procfs) {
+		proc_remove(cd->procfs);
+		cd->procfs = NULL;
+	}
 }
 
 #ifdef CONFIG_PROC_FS
@@ -1624,38 +1615,30 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
 	struct sunrpc_net *sn;
 
 	sn = net_generic(net, sunrpc_net_id);
-	cd->u.procfs.proc_ent = proc_mkdir(cd->name, sn->proc_net_rpc);
-	if (cd->u.procfs.proc_ent == NULL)
+	cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc);
+	if (cd->procfs == NULL)
 		goto out_nomem;
-	cd->u.procfs.channel_ent = NULL;
-	cd->u.procfs.content_ent = NULL;
 
 	p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR,
-			     cd->u.procfs.proc_ent,
-			     &cache_flush_operations_procfs, cd);
-	cd->u.procfs.flush_ent = p;
+			     cd->procfs, &cache_flush_operations_procfs, cd);
 	if (p == NULL)
 		goto out_nomem;
 
 	if (cd->cache_request || cd->cache_parse) {
 		p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR,
-				     cd->u.procfs.proc_ent,
-				     &cache_file_operations_procfs, cd);
-		cd->u.procfs.channel_ent = p;
+				cd->procfs, &cache_file_operations_procfs, cd);
 		if (p == NULL)
 			goto out_nomem;
 	}
 	if (cd->cache_show) {
 		p = proc_create_data("content", S_IFREG|S_IRUSR,
-				cd->u.procfs.proc_ent,
-				&content_file_operations_procfs, cd);
-		cd->u.procfs.content_ent = p;
+				cd->procfs, &content_file_operations_procfs, cd);
 		if (p == NULL)
 			goto out_nomem;
 	}
 	return 0;
 out_nomem:
-	remove_cache_proc_entries(cd, net);
+	remove_cache_proc_entries(cd);
 	return -ENOMEM;
 }
 #else /* CONFIG_PROC_FS */
@@ -1684,7 +1667,7 @@ EXPORT_SYMBOL_GPL(cache_register_net);
 
 void cache_unregister_net(struct cache_detail *cd, struct net *net)
 {
-	remove_cache_proc_entries(cd, net);
+	remove_cache_proc_entries(cd);
 	sunrpc_destroy_cache_detail(cd);
 }
 EXPORT_SYMBOL_GPL(cache_unregister_net);
@@ -1843,15 +1826,17 @@ int sunrpc_cache_register_pipefs(struct dentry *parent,
 	struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd);
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
-	cd->u.pipefs.dir = dir;
+	cd->pipefs = dir;
 	return 0;
 }
 EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs);
 
 void sunrpc_cache_unregister_pipefs(struct cache_detail *cd)
 {
-	rpc_remove_cache_dir(cd->u.pipefs.dir);
-	cd->u.pipefs.dir = NULL;
+	if (cd->pipefs) {
+		rpc_remove_cache_dir(cd->pipefs);
+		cd->pipefs = NULL;
+	}
 }
 EXPORT_SYMBOL_GPL(sunrpc_cache_unregister_pipefs);
 
-- 
2.9.3


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

* [PATCH 3/7] sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
  2017-02-07 13:46 ` [PATCH 1/7] sunrpc: error out if register_shrinker fail Kinglong Mee
  2017-02-07 13:47 ` [PATCH 2/7] sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail Kinglong Mee
@ 2017-02-07 13:48 ` Kinglong Mee
  2017-02-07 13:48 ` [PATCH 4/7] sunrpc: remove dead codes of cr_magic in rpc_cred Kinglong Mee
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:48 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

NFS_NGROUPS has been move to sunrpc, rename to UNX_NGROUPS.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 include/linux/sunrpc/auth.h |  1 +
 net/sunrpc/auth_unix.c      | 18 ++++++++----------
 net/sunrpc/svcauth_unix.c   |  4 ++--
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index b1bc62b..39c85fb 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -32,6 +32,7 @@
  */
 #define UNX_MAXNODENAME	__NEW_UTS_LEN
 #define UNX_CALLSLACK	(21 + XDR_QUADLEN(UNX_MAXNODENAME))
+#define UNX_NGROUPS	16
 
 struct rpcsec_gss_info;
 
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 306fc0f..82337e1 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -14,12 +14,10 @@
 #include <linux/sunrpc/auth.h>
 #include <linux/user_namespace.h>
 
-#define NFS_NGROUPS	16
-
 struct unx_cred {
 	struct rpc_cred		uc_base;
 	kgid_t			uc_gid;
-	kgid_t			uc_gids[NFS_NGROUPS];
+	kgid_t			uc_gids[UNX_NGROUPS];
 };
 #define uc_uid			uc_base.cr_uid
 
@@ -82,13 +80,13 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t
 
 	if (acred->group_info != NULL)
 		groups = acred->group_info->ngroups;
-	if (groups > NFS_NGROUPS)
-		groups = NFS_NGROUPS;
+	if (groups > UNX_NGROUPS)
+		groups = UNX_NGROUPS;
 
 	cred->uc_gid = acred->gid;
 	for (i = 0; i < groups; i++)
 		cred->uc_gids[i] = acred->group_info->gid[i];
-	if (i < NFS_NGROUPS)
+	if (i < UNX_NGROUPS)
 		cred->uc_gids[i] = INVALID_GID;
 
 	return &cred->uc_base;
@@ -132,12 +130,12 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
 
 	if (acred->group_info != NULL)
 		groups = acred->group_info->ngroups;
-	if (groups > NFS_NGROUPS)
-		groups = NFS_NGROUPS;
+	if (groups > UNX_NGROUPS)
+		groups = UNX_NGROUPS;
 	for (i = 0; i < groups ; i++)
 		if (!gid_eq(cred->uc_gids[i], acred->group_info->gid[i]))
 			return 0;
-	if (groups < NFS_NGROUPS && gid_valid(cred->uc_gids[groups]))
+	if (groups < UNX_NGROUPS && gid_valid(cred->uc_gids[groups]))
 		return 0;
 	return 1;
 }
@@ -166,7 +164,7 @@ unx_marshal(struct rpc_task *task, __be32 *p)
 	*p++ = htonl((u32) from_kuid(&init_user_ns, cred->uc_uid));
 	*p++ = htonl((u32) from_kgid(&init_user_ns, cred->uc_gid));
 	hold = p++;
-	for (i = 0; i < 16 && gid_valid(cred->uc_gids[i]); i++)
+	for (i = 0; i < UNX_NGROUPS && gid_valid(cred->uc_gids[i]); i++)
 		*p++ = htonl((u32) from_kgid(&init_user_ns, cred->uc_gids[i]));
 	*hold = htonl(p - hold - 1);		/* gid array length */
 	*base = htonl((p - base - 1) << 2);	/* cred length */
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 64af4f0..f81eaa8 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -403,7 +403,7 @@ svcauth_unix_info_release(struct svc_xprt *xpt)
 /****************************************************************************
  * auth.unix.gid cache
  * simple cache to map a UID to a list of GIDs
- * because AUTH_UNIX aka AUTH_SYS has a max of 16
+ * because AUTH_UNIX aka AUTH_SYS has a max of UNX_NGROUPS
  */
 #define	GID_HASHBITS	8
 #define	GID_HASHMAX	(1<<GID_HASHBITS)
@@ -810,7 +810,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
 	cred->cr_uid = make_kuid(&init_user_ns, svc_getnl(argv)); /* uid */
 	cred->cr_gid = make_kgid(&init_user_ns, svc_getnl(argv)); /* gid */
 	slen = svc_getnl(argv);			/* gids length */
-	if (slen > 16 || (len -= (slen + 2)*4) < 0)
+	if (slen > UNX_NGROUPS || (len -= (slen + 2)*4) < 0)
 		goto badcred;
 	cred->cr_group_info = groups_alloc(slen);
 	if (cred->cr_group_info == NULL)
-- 
2.9.3


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

* [PATCH 4/7] sunrpc: remove dead codes of cr_magic in rpc_cred
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
                   ` (2 preceding siblings ...)
  2017-02-07 13:48 ` [PATCH 3/7] sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix Kinglong Mee
@ 2017-02-07 13:48 ` Kinglong Mee
  2017-02-07 13:49 ` [PATCH 5/7] sunrpc: update the comments of sunrpc proc path Kinglong Mee
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:48 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

Don't found any place using the cr_magic.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 include/linux/sunrpc/auth.h | 5 -----
 net/sunrpc/auth.c           | 3 ---
 net/sunrpc/auth_null.c      | 3 ---
 3 files changed, 11 deletions(-)

diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 39c85fb..8fd3504 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -64,9 +64,6 @@ struct rpc_cred {
 	struct rcu_head		cr_rcu;
 	struct rpc_auth *	cr_auth;
 	const struct rpc_credops *cr_ops;
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-	unsigned long		cr_magic;	/* 0x0f4aa4f0 */
-#endif
 	unsigned long		cr_expire;	/* when to gc */
 	unsigned long		cr_flags;	/* various flags */
 	atomic_t		cr_count;	/* ref count */
@@ -80,8 +77,6 @@ struct rpc_cred {
 #define RPCAUTH_CRED_HASHED	2
 #define RPCAUTH_CRED_NEGATIVE	3
 
-#define RPCAUTH_CRED_MAGIC	0x0f4aa4f0
-
 /* rpc_auth au_flags */
 #define RPCAUTH_AUTH_NO_CRKEY_TIMEOUT	0x0001 /* underlying cred has no key timeout */
 
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 2bff63a..a7d03ea 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -646,9 +646,6 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
 	cred->cr_auth = auth;
 	cred->cr_ops = ops;
 	cred->cr_expire = jiffies;
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-	cred->cr_magic = RPCAUTH_CRED_MAGIC;
-#endif
 	cred->cr_uid = acred->uid;
 }
 EXPORT_SYMBOL_GPL(rpcauth_init_cred);
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index 4d17376..5f3d527 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -139,7 +139,4 @@ struct rpc_cred null_cred = {
 	.cr_ops		= &null_credops,
 	.cr_count	= ATOMIC_INIT(1),
 	.cr_flags	= 1UL << RPCAUTH_CRED_UPTODATE,
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-	.cr_magic	= RPCAUTH_CRED_MAGIC,
-#endif
 };
-- 
2.9.3


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

* [PATCH 5/7] sunrpc: update the comments of sunrpc proc path
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
                   ` (3 preceding siblings ...)
  2017-02-07 13:48 ` [PATCH 4/7] sunrpc: remove dead codes of cr_magic in rpc_cred Kinglong Mee
@ 2017-02-07 13:49 ` Kinglong Mee
  2017-02-07 13:49 ` [PATCH 6/7] sunrpc: record rpc client pointer in seq->private directly Kinglong Mee
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:49 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 net/sunrpc/cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 688ef8c..9e8561d 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -717,7 +717,7 @@ void cache_clean_deferred(void *owner)
 /*
  * communicate with user-space
  *
- * We have a magic /proc file - /proc/sunrpc/<cachename>/channel.
+ * We have a magic /proc file - /proc/net/rpc/<cachename>/channel.
  * On read, you get a full request, or block.
  * On write, an update request is processed.
  * Poll works if anything to read, and always allows write.
@@ -1272,7 +1272,7 @@ EXPORT_SYMBOL_GPL(qword_get);
 
 
 /*
- * support /proc/sunrpc/cache/$CACHENAME/content
+ * support /proc/net/rpc/$CACHENAME/content
  * as a seqfile.
  * We call ->cache_show passing NULL for the item to
  * get a header, then pass each real item in the cache
-- 
2.9.3


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

* [PATCH 6/7] sunrpc: record rpc client pointer in seq->private directly
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
                   ` (4 preceding siblings ...)
  2017-02-07 13:49 ` [PATCH 5/7] sunrpc: update the comments of sunrpc proc path Kinglong Mee
@ 2017-02-07 13:49 ` Kinglong Mee
  2017-02-07 13:50 ` [PATCH 7/7] sunrpc: use simple_read_from_buffer for reading cache flush Kinglong Mee
  2017-02-17 17:03 ` [PATCH 0/7] Some cleanups and updates for sunrpc J. Bruce Fields
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:49 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

pos in rpc_clnt_iter is useless, drop it and record clnt in seq_private.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 net/sunrpc/debugfs.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index e7b4d93..c8fd0b6 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -16,11 +16,6 @@ static struct dentry *rpc_xprt_dir;
 
 unsigned int rpc_inject_disconnect;
 
-struct rpc_clnt_iter {
-	struct rpc_clnt	*clnt;
-	loff_t		pos;
-};
-
 static int
 tasks_show(struct seq_file *f, void *v)
 {
@@ -47,12 +42,10 @@ static void *
 tasks_start(struct seq_file *f, loff_t *ppos)
 	__acquires(&clnt->cl_lock)
 {
-	struct rpc_clnt_iter *iter = f->private;
+	struct rpc_clnt *clnt = f->private;
 	loff_t pos = *ppos;
-	struct rpc_clnt *clnt = iter->clnt;
 	struct rpc_task *task;
 
-	iter->pos = pos + 1;
 	spin_lock(&clnt->cl_lock);
 	list_for_each_entry(task, &clnt->cl_tasks, tk_task)
 		if (pos-- == 0)
@@ -63,12 +56,10 @@ tasks_start(struct seq_file *f, loff_t *ppos)
 static void *
 tasks_next(struct seq_file *f, void *v, loff_t *pos)
 {
-	struct rpc_clnt_iter *iter = f->private;
-	struct rpc_clnt *clnt = iter->clnt;
+	struct rpc_clnt *clnt = f->private;
 	struct rpc_task *task = v;
 	struct list_head *next = task->tk_task.next;
 
-	++iter->pos;
 	++*pos;
 
 	/* If there's another task on list, return it */
@@ -81,9 +72,7 @@ static void
 tasks_stop(struct seq_file *f, void *v)
 	__releases(&clnt->cl_lock)
 {
-	struct rpc_clnt_iter *iter = f->private;
-	struct rpc_clnt *clnt = iter->clnt;
-
+	struct rpc_clnt *clnt = f->private;
 	spin_unlock(&clnt->cl_lock);
 }
 
@@ -96,17 +85,13 @@ static const struct seq_operations tasks_seq_operations = {
 
 static int tasks_open(struct inode *inode, struct file *filp)
 {
-	int ret = seq_open_private(filp, &tasks_seq_operations,
-					sizeof(struct rpc_clnt_iter));
-
+	int ret = seq_open(filp, &tasks_seq_operations);
 	if (!ret) {
 		struct seq_file *seq = filp->private_data;
-		struct rpc_clnt_iter *iter = seq->private;
-
-		iter->clnt = inode->i_private;
+		struct rpc_clnt *clnt = seq->private = inode->i_private;
 
-		if (!atomic_inc_not_zero(&iter->clnt->cl_count)) {
-			seq_release_private(inode, filp);
+		if (!atomic_inc_not_zero(&clnt->cl_count)) {
+			seq_release(inode, filp);
 			ret = -EINVAL;
 		}
 	}
@@ -118,10 +103,10 @@ static int
 tasks_release(struct inode *inode, struct file *filp)
 {
 	struct seq_file *seq = filp->private_data;
-	struct rpc_clnt_iter *iter = seq->private;
+	struct rpc_clnt *clnt = seq->private;
 
-	rpc_release_client(iter->clnt);
-	return seq_release_private(inode, filp);
+	rpc_release_client(clnt);
+	return seq_release(inode, filp);
 }
 
 static const struct file_operations tasks_fops = {
-- 
2.9.3


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

* [PATCH 7/7] sunrpc: use simple_read_from_buffer for reading cache flush
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
                   ` (5 preceding siblings ...)
  2017-02-07 13:49 ` [PATCH 6/7] sunrpc: record rpc client pointer in seq->private directly Kinglong Mee
@ 2017-02-07 13:50 ` Kinglong Mee
  2017-02-17 17:03 ` [PATCH 0/7] Some cleanups and updates for sunrpc J. Bruce Fields
  7 siblings, 0 replies; 14+ messages in thread
From: Kinglong Mee @ 2017-02-07 13:50 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Trond Myklebust, Kinglong Mee

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 net/sunrpc/cache.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9e8561d..2f06f51 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
 			  struct cache_detail *cd)
 {
 	char tbuf[22];
-	unsigned long p = *ppos;
 	size_t len;
 
-	snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
-	len = strlen(tbuf);
-	if (p >= len)
-		return 0;
-	len -= p;
-	if (len > count)
-		len = count;
-	if (copy_to_user(buf, (void*)(tbuf+p), len))
-		return -EFAULT;
-	*ppos += len;
-	return len;
+	len = snprintf(tbuf, sizeof(tbuf), "%lu\n",
+			convert_to_wallclock(cd->flush_time));
+	return simple_read_from_buffer(buf, count, ppos, tbuf, len);
 }
 
 static ssize_t write_flush(struct file *file, const char __user *buf,
-- 
2.9.3


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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
                   ` (6 preceding siblings ...)
  2017-02-07 13:50 ` [PATCH 7/7] sunrpc: use simple_read_from_buffer for reading cache flush Kinglong Mee
@ 2017-02-17 17:03 ` J. Bruce Fields
  2017-02-17 17:25   ` Trond Myklebust
  7 siblings, 1 reply; 14+ messages in thread
From: J. Bruce Fields @ 2017-02-17 17:03 UTC (permalink / raw)
  To: Kinglong Mee; +Cc: linux-nfs, Trond Myklebust

Thanks, these look fine to me.

It's really a mixture of client- and server- side stuff, but seems
unlikely to have serious conflicts with either.  For simplicity's sake I
think I'll just take them, unless Trond tells me he has.

--b.

On Tue, Feb 07, 2017 at 09:44:31PM +0800, Kinglong Mee wrote:
> The first one is an bugfix of checking register_shrinker's result,
> the following sixes are codes cleanup and updates.
> 
> Kinglong Mee (7):
>   sunrpc: error out if register_shrinker fail
>   sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail
>   sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix
>   sunrpc: remove dead codes of cr_magic in rpc_cred
>   sunrpc: update the comments of sunrpc proc path
>   sunrpc: record rpc client pointer in seq->private directly
>   sunrpc: use simple_read_from_buffer for reading cache flush
> 
>  fs/nfs/cache_lib.c           |  3 +-
>  include/linux/sunrpc/auth.h  |  6 +---
>  include/linux/sunrpc/cache.h | 15 ++--------
>  net/sunrpc/auth.c            |  9 +++---
>  net/sunrpc/auth_null.c       |  3 --
>  net/sunrpc/auth_unix.c       | 18 ++++++------
>  net/sunrpc/cache.c           | 68 ++++++++++++++------------------------------
>  net/sunrpc/debugfs.c         | 35 +++++++----------------
>  net/sunrpc/svcauth_unix.c    |  4 +--
>  9 files changed, 52 insertions(+), 109 deletions(-)
> 
> -- 
> 2.9.3
> 

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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-17 17:03 ` [PATCH 0/7] Some cleanups and updates for sunrpc J. Bruce Fields
@ 2017-02-17 17:25   ` Trond Myklebust
  2017-02-17 19:09     ` bfields
  0 siblings, 1 reply; 14+ messages in thread
From: Trond Myklebust @ 2017-02-17 17:25 UTC (permalink / raw)
  To: bfields, kinglongmee; +Cc: Anna.Schumaker, linux-nfs

T24gRnJpLCAyMDE3LTAyLTE3IGF0IDEyOjAzIC0wNTAwLCBKLiBCcnVjZSBGaWVsZHMgd3JvdGU6
DQo+IFRoYW5rcywgdGhlc2UgbG9vayBmaW5lIHRvIG1lLg0KPiANCj4gSXQncyByZWFsbHkgYSBt
aXh0dXJlIG9mIGNsaWVudC0gYW5kIHNlcnZlci0gc2lkZSBzdHVmZiwgYnV0IHNlZW1zDQo+IHVu
bGlrZWx5IHRvIGhhdmUgc2VyaW91cyBjb25mbGljdHMgd2l0aCBlaXRoZXIuwqDCoEZvciBzaW1w
bGljaXR5J3MNCj4gc2FrZSBJDQo+IHRoaW5rIEknbGwganVzdCB0YWtlIHRoZW0sIHVubGVzcyBU
cm9uZCB0ZWxscyBtZSBoZSBoYXMuDQo+IA0KDQpBbm5hIGlzIG1hbmFnaW5nIHRoZSBtZXJnZSB3
aW5kb3cgZm9yIHRoZSBvZGQtbnVtYmVyZWQga2VybmVsIHJlbGVhc2VzDQooQ2NlZCkuDQoNCi0t
IA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIsIFByaW1hcnlE
YXRhDQp0cm9uZC5teWtsZWJ1c3RAcHJpbWFyeWRhdGEuY29tDQo=


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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-17 17:25   ` Trond Myklebust
@ 2017-02-17 19:09     ` bfields
  2017-02-17 21:15       ` Anna Schumaker
  2017-02-17 22:18       ` Trond Myklebust
  0 siblings, 2 replies; 14+ messages in thread
From: bfields @ 2017-02-17 19:09 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: kinglongmee, Anna.Schumaker, linux-nfs

On Fri, Feb 17, 2017 at 05:25:04PM +0000, Trond Myklebust wrote:
> On Fri, 2017-02-17 at 12:03 -0500, J. Bruce Fields wrote:
> > Thanks, these look fine to me.
> > 
> > It's really a mixture of client- and server- side stuff, but seems
> > unlikely to have serious conflicts with either.  For simplicity's
> > sake I
> > think I'll just take them, unless Trond tells me he has.
> > 
> 
> Anna is managing the merge window for the odd-numbered kernel releases
> (Cced).

Got it, thanks.  Anna, I've currently got this queued up in my tree, but
let me know if that's a problem.

(This every-other-kernel scheme would be easier for me to remember if
only one of you was clearly odder than the other.  But I think you're
about equally odd.)

--b.

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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-17 19:09     ` bfields
@ 2017-02-17 21:15       ` Anna Schumaker
  2017-02-17 21:26         ` bfields
  2017-02-17 22:18       ` Trond Myklebust
  1 sibling, 1 reply; 14+ messages in thread
From: Anna Schumaker @ 2017-02-17 21:15 UTC (permalink / raw)
  To: bfields, Trond Myklebust; +Cc: kinglongmee, linux-nfs

Hi Bruce,

On 02/17/2017 02:09 PM, bfields@fieldses.org wrote:
> On Fri, Feb 17, 2017 at 05:25:04PM +0000, Trond Myklebust wrote:
>> On Fri, 2017-02-17 at 12:03 -0500, J. Bruce Fields wrote:
>>> Thanks, these look fine to me.
>>>
>>> It's really a mixture of client- and server- side stuff, but seems
>>> unlikely to have serious conflicts with either.  For simplicity's
>>> sake I
>>> think I'll just take them, unless Trond tells me he has.
>>>
>>
>> Anna is managing the merge window for the odd-numbered kernel releases
>> (Cced).
> 
> Got it, thanks.  Anna, I've currently got this queued up in my tree, but
> let me know if that's a problem.

I have everything applied to my tree, but I don't mind if you want to take all the patches :)

> 
> (This every-other-kernel scheme would be easier for me to remember if
> only one of you was clearly odder than the other.  But I think you're
> about equally odd.)

Well, I guess I could try to find even more weird hobbies ...

> 
> --b.
> 

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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-17 21:15       ` Anna Schumaker
@ 2017-02-17 21:26         ` bfields
  0 siblings, 0 replies; 14+ messages in thread
From: bfields @ 2017-02-17 21:26 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: Trond Myklebust, kinglongmee, linux-nfs

On Fri, Feb 17, 2017 at 04:15:56PM -0500, Anna Schumaker wrote:
> Hi Bruce,
> 
> On 02/17/2017 02:09 PM, bfields@fieldses.org wrote:
> > On Fri, Feb 17, 2017 at 05:25:04PM +0000, Trond Myklebust wrote:
> >> On Fri, 2017-02-17 at 12:03 -0500, J. Bruce Fields wrote:
> >>> Thanks, these look fine to me.
> >>>
> >>> It's really a mixture of client- and server- side stuff, but seems
> >>> unlikely to have serious conflicts with either.  For simplicity's
> >>> sake I
> >>> think I'll just take them, unless Trond tells me he has.
> >>>
> >>
> >> Anna is managing the merge window for the odd-numbered kernel releases
> >> (Cced).
> > 
> > Got it, thanks.  Anna, I've currently got this queued up in my tree, but
> > let me know if that's a problem.
> 
> I have everything applied to my tree, but I don't mind if you want to take all the patches :)

I'll leave them to you--I've dropped these 7 patches.

> > (This every-other-kernel scheme would be easier for me to remember if
> > only one of you was clearly odder than the other.  But I think you're
> > about equally odd.)
> 
> Well, I guess I could try to find even more weird hobbies ...

I'll look forward to hearing more.

--b.

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

* Re: [PATCH 0/7] Some cleanups and updates for sunrpc
  2017-02-17 19:09     ` bfields
  2017-02-17 21:15       ` Anna Schumaker
@ 2017-02-17 22:18       ` Trond Myklebust
  1 sibling, 0 replies; 14+ messages in thread
From: Trond Myklebust @ 2017-02-17 22:18 UTC (permalink / raw)
  To: bfields; +Cc: kinglongmee, Anna.Schumaker, linux-nfs

T24gRnJpLCAyMDE3LTAyLTE3IGF0IDE0OjA5IC0wNTAwLCBiZmllbGRzQGZpZWxkc2VzLm9yZyB3
cm90ZToNCj4gKFRoaXMgZXZlcnktb3RoZXIta2VybmVsIHNjaGVtZSB3b3VsZCBiZSBlYXNpZXIg
Zm9yIG1lIHRvIHJlbWVtYmVyIGlmDQo+IG9ubHkgb25lIG9mIHlvdSB3YXMgY2xlYXJseSBvZGRl
ciB0aGFuIHRoZSBvdGhlci7CoMKgQnV0IEkgdGhpbmsgeW91J3JlDQo+IGFib3V0IGVxdWFsbHkg
b2RkLikNCj4gDQoNClNvIHlvdSdyZSBzYXlpbmcgd2UncmUgZXZlbj8NCg0KLS0gDQpUcm9uZCBN
eWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lciwgUHJpbWFyeURhdGENCnRyb25k
Lm15a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20NCg==


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

end of thread, other threads:[~2017-02-17 22:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 13:44 [PATCH 0/7] Some cleanups and updates for sunrpc Kinglong Mee
2017-02-07 13:46 ` [PATCH 1/7] sunrpc: error out if register_shrinker fail Kinglong Mee
2017-02-07 13:47 ` [PATCH 2/7] sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail Kinglong Mee
2017-02-07 13:48 ` [PATCH 3/7] sunrpc: rename NFS_NGROUPS to UNX_NGROUPS for auth unix Kinglong Mee
2017-02-07 13:48 ` [PATCH 4/7] sunrpc: remove dead codes of cr_magic in rpc_cred Kinglong Mee
2017-02-07 13:49 ` [PATCH 5/7] sunrpc: update the comments of sunrpc proc path Kinglong Mee
2017-02-07 13:49 ` [PATCH 6/7] sunrpc: record rpc client pointer in seq->private directly Kinglong Mee
2017-02-07 13:50 ` [PATCH 7/7] sunrpc: use simple_read_from_buffer for reading cache flush Kinglong Mee
2017-02-17 17:03 ` [PATCH 0/7] Some cleanups and updates for sunrpc J. Bruce Fields
2017-02-17 17:25   ` Trond Myklebust
2017-02-17 19:09     ` bfields
2017-02-17 21:15       ` Anna Schumaker
2017-02-17 21:26         ` bfields
2017-02-17 22:18       ` Trond Myklebust

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.