linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 09/11] nfs: convert idmapper to rpc_mkpipe_clnt
Date: Sun, 01 Dec 2013 05:14:50 -0800	[thread overview]
Message-ID: <20131201132011.305242374@bombadil.infradead.org> (raw)
In-Reply-To: 20131201131441.790963326@bombadil.infradead.org

[-- Attachment #1: 0009-nfs-convert-idmapper-to-rpc_mkpipe_clnt.patch --]
[-- Type: text/plain, Size: 3165 bytes --]

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 fs/nfs/idmap.c |   74 +++++++-------------------------------------------------
 1 file changed, 9 insertions(+), 65 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 567983d..91459b0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -64,7 +64,6 @@ struct idmap_legacy_upcalldata {
 };
 
 struct idmap {
-	struct rpc_pipe_dir_object idmap_pdo;
 	struct rpc_pipe		*idmap_pipe;
 	struct idmap_legacy_upcalldata *idmap_upcall_data;
 	struct mutex		idmap_mutex;
@@ -403,73 +402,25 @@ static struct key_type key_type_id_resolver_legacy = {
 	.request_key	= nfs_idmap_legacy_upcall,
 };
 
-static void nfs_idmap_pipe_destroy(struct dentry *dir,
-		struct rpc_pipe_dir_object *pdo)
-{
-	struct idmap *idmap = pdo->pdo_data;
-	struct rpc_pipe *pipe = idmap->idmap_pipe;
-
-	if (pipe->dentry) {
-		rpc_unlink(pipe->dentry);
-		pipe->dentry = NULL;
-	}
-}
-
-static int nfs_idmap_pipe_create(struct dentry *dir,
-		struct rpc_pipe_dir_object *pdo)
-{
-	struct idmap *idmap = pdo->pdo_data;
-	struct rpc_pipe *pipe = idmap->idmap_pipe;
-	struct dentry *dentry;
-
-	dentry = rpc_mkpipe_dentry(dir, "idmap", idmap, pipe);
-	if (IS_ERR(dentry))
-		return PTR_ERR(dentry);
-	pipe->dentry = dentry;
-	return 0;
-}
-
-static const struct rpc_pipe_dir_object_ops nfs_idmap_pipe_dir_object_ops = {
-	.create = nfs_idmap_pipe_create,
-	.destroy = nfs_idmap_pipe_destroy,
-};
-
 int
 nfs_idmap_new(struct nfs_client *clp)
 {
 	struct idmap *idmap;
-	struct rpc_pipe *pipe;
-	int error;
 
 	idmap = kzalloc(sizeof(*idmap), GFP_KERNEL);
 	if (idmap == NULL)
 		return -ENOMEM;
-
-	rpc_init_pipe_dir_object(&idmap->idmap_pdo,
-			&nfs_idmap_pipe_dir_object_ops,
-			idmap);
-
-	pipe = rpc_mkpipe_data(&idmap_upcall_ops, 0);
-	if (IS_ERR(pipe)) {
-		error = PTR_ERR(pipe);
-		goto err;
-	}
-	idmap->idmap_pipe = pipe;
 	mutex_init(&idmap->idmap_mutex);
 
-	error = rpc_add_pipe_dir_object(clp->cl_net,
-			&clp->cl_rpcclient->cl_pipedir_objects,
-			&idmap->idmap_pdo);
-	if (error)
-		goto err_destroy_pipe;
+	idmap->idmap_pipe = rpc_mkpipe_clnt(clp->cl_rpcclient, "idmap",
+				&idmap_upcall_ops, idmap, 0);
+	if (IS_ERR(idmap->idmap_pipe)) {
+		kfree(idmap);
+		return PTR_ERR(idmap->idmap_pipe);
+	}
 
 	clp->cl_idmap = idmap;
 	return 0;
-err_destroy_pipe:
-	rpc_destroy_pipe_data(idmap->idmap_pipe);
-err:
-	kfree(idmap);
-	return error;
 }
 
 void
@@ -479,22 +430,15 @@ nfs_idmap_delete(struct nfs_client *clp)
 
 	if (!idmap)
 		return;
+
+	rpc_rmpipe(idmap->idmap_pipe);
 	clp->cl_idmap = NULL;
-	rpc_remove_pipe_dir_object(clp->cl_net,
-			&clp->cl_rpcclient->cl_pipedir_objects,
-			&idmap->idmap_pdo);
-	rpc_destroy_pipe_data(idmap->idmap_pipe);
 	kfree(idmap);
 }
 
 int nfs_idmap_init(void)
 {
-	int ret;
-	ret = nfs_idmap_init_keyring();
-	if (ret != 0)
-		goto out;
-out:
-	return ret;
+	return nfs_idmap_init_keyring();
 }
 
 void nfs_idmap_quit(void)
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-12-01 13:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-01 13:14 [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Christoph Hellwig
2013-12-01 13:14 ` [PATCH 01/11] sunrpc: allocate pipefs inodes using kmalloc Christoph Hellwig
     [not found]   ` <20131201132009.815675002-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2013-12-01 14:26     ` Jeff Layton
2013-12-01 13:14 ` [PATCH 02/11] rpc_pipefs: always mount on net namespace initialization Christoph Hellwig
2013-12-01 15:24   ` Jeff Layton
2013-12-01 13:14 ` [PATCH 03/11] sunrpc: remove the rpc_clients_block notifier Christoph Hellwig
2013-12-01 15:25   ` Jeff Layton
2013-12-01 13:14 ` [PATCH 04/11] sunrpc: no need to have a lock or superblock for rpc_unlink Christoph Hellwig
2013-12-01 13:14 ` [PATCH 05/11] sunprc: add sensible pipe creation and removal helpers Christoph Hellwig
2013-12-01 13:14 ` [PATCH 06/11] sunrpc: clean up rpc_pipefs client dir creation Christoph Hellwig
2013-12-01 13:14 ` [PATCH 07/11] sunrpc: make rpc_mkdir_populate net-namespace aware Christoph Hellwig
2013-12-01 13:14 ` [PATCH 08/11] sunrpc: rpc_get_sb_net, die, die, die Christoph Hellwig
2013-12-01 13:14 ` Christoph Hellwig [this message]
2013-12-01 13:14 ` [PATCH 10/11] auth_gss: convert to rpc_mkpipe_clnt Christoph Hellwig
2013-12-01 13:14 ` [PATCH 11/11] sunrpc: rpc_pipefs cleanup Christoph Hellwig
     [not found] ` <20131201131441.790963326-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2013-12-01 14:36   ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Jeff Layton
2013-12-01 15:44   ` Jeff Layton
2013-12-01 15:57     ` Jeff Layton
2013-12-01 18:13   ` Al Viro
     [not found]     ` <20131201181329.GC10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-12-02  8:12       ` Christoph Hellwig
2013-12-02 13:44         ` Trond Myklebust
2013-12-02 14:24           ` Stanislav Kinsbursky
     [not found]             ` <529C982B.2030906-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-12-02 15:36               ` Christoph Hellwig
2013-12-02 15:58               ` Trond Myklebust
     [not found]                 ` <5872AE74-DF03-42E2-A21B-F8E35634CD1D-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-03  7:24                   ` Stanislav Kinsbursky
     [not found]           ` <3C65EB4C-6592-44F8-B08D-E5A9EFD6C8C6-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-02 15:34             ` Christoph Hellwig
     [not found]               ` <20131202153435.GA2804-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-12-02 16:00                 ` Trond Myklebust
     [not found]                   ` <BCED1826-0743-4420-AD45-B38D67EF3D99-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-02 16:27                     ` Christoph Hellwig
     [not found]                       ` <20131202162716.GA17417-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-12-02 16:46                         ` Trond Myklebust
2013-12-02 16:33                   ` Jeff Layton
2013-12-02 16:37                     ` J. Bruce Fields
2013-12-02 16:45                       ` Jeff Layton
2013-12-02 15:57             ` Al Viro
2013-12-02 16:04               ` Trond Myklebust
2013-12-03  2:11       ` [RFC] alloc_pid() breakage Al Viro
2013-12-02  7:23   ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Stanislav Kinsbursky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131201132011.305242374@bombadil.infradead.org \
    --to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).