linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFS: Ensure that the nfs_client 'net' field is always set
@ 2012-02-19  7:50 Trond Myklebust
  2012-02-19  7:50 ` [PATCH 2/2] NFS: Ensure struct nfs_client holds a reference to the net namespace Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2012-02-19  7:50 UTC (permalink / raw)
  To: linux-nfs; +Cc: Stanislav Kinsbursky

Currently, the nfs_parsed_mount_data->net field is initialised in
the nfs_parse_mount_options() function, which means that it only
gets set if we're using text based mounts. The legacy binary
mount interface is therefore broken.

Fix is to initialise the ->net field in nfs_alloc_parsed_mount_data.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
---
 fs/nfs/super.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d05024a..6708f30 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -911,6 +911,7 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int ve
 		data->auth_flavor_len	= 1;
 		data->version		= version;
 		data->minorversion	= 0;
+		data->net		= current->nsproxy->net_ns;
 		security_init_mnt_opts(&data->lsm_opts);
 	}
 	return data;
@@ -1110,8 +1111,6 @@ static int nfs_parse_mount_options(char *raw,
 
 	free_secdata(secdata);
 
-	mnt->net = current->nsproxy->net_ns;
-
 	while ((p = strsep(&raw, ",")) != NULL) {
 		substring_t args[MAX_OPT_ARGS];
 		unsigned long option;
-- 
1.7.7.6


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

* [PATCH 2/2] NFS: Ensure struct nfs_client holds a reference to the net namespace
  2012-02-19  7:50 [PATCH 1/2] NFS: Ensure that the nfs_client 'net' field is always set Trond Myklebust
@ 2012-02-19  7:50 ` Trond Myklebust
  2012-02-22 12:51   ` Stanislav Kinsbursky
  0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2012-02-19  7:50 UTC (permalink / raw)
  To: linux-nfs; +Cc: Stanislav Kinsbursky

Otherwise we have no guarantee that the net namespace won't just
disappear from underneath us once the task that created it
is destroyed.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
---
 fs/nfs/client.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index d0f850f..8563585 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -172,7 +172,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
 	clp->cl_rpcclient = ERR_PTR(-EINVAL);
 
 	clp->cl_proto = cl_init->proto;
-	clp->net = cl_init->net;
+	clp->net = get_net(cl_init->net);
 
 #ifdef CONFIG_NFS_V4
 	err = nfs_get_cb_ident_idr(clp, cl_init->minorversion);
@@ -300,6 +300,7 @@ static void nfs_free_client(struct nfs_client *clp)
 
 	nfs4_deviceid_purge_client(clp);
 
+	put_net(clp->net);
 	kfree(clp->cl_hostname);
 	kfree(clp->server_scope);
 	kfree(clp);
-- 
1.7.7.6


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

* Re: [PATCH 2/2] NFS: Ensure struct nfs_client holds a reference to the net namespace
  2012-02-19  7:50 ` [PATCH 2/2] NFS: Ensure struct nfs_client holds a reference to the net namespace Trond Myklebust
@ 2012-02-22 12:51   ` Stanislav Kinsbursky
  0 siblings, 0 replies; 3+ messages in thread
From: Stanislav Kinsbursky @ 2012-02-22 12:51 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs@vger.kernel.org

19.02.2012 11:50, Trond Myklebust пишет:
> Otherwise we have no guarantee that the net namespace won't just
> disappear from underneath us once the task that created it
> is destroyed.

I'm not 100% sure, but holding net reference on NFS client level looks redundant 
to me, because nfs_client holds net reference on transport level (xprt_net).
But this is not an objection: code looks clearer and safer with this patch.

-- 
Best regards,
Stanislav Kinsbursky

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

end of thread, other threads:[~2012-02-22 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-19  7:50 [PATCH 1/2] NFS: Ensure that the nfs_client 'net' field is always set Trond Myklebust
2012-02-19  7:50 ` [PATCH 2/2] NFS: Ensure struct nfs_client holds a reference to the net namespace Trond Myklebust
2012-02-22 12:51   ` Stanislav Kinsbursky

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).