[pnfs] [PATCH 1/2] nfs41: Add missing call to destroy session in nfs4_get_sb.

Benny Halevy bhalevy at panasas.com
Mon Feb 4 12:38:11 EST 2008


Applied onto the nfs41 branch

Note that this is modified in the pnfs branch as nfs4_proc_destroy_session's
params were changed there to accommodate for destroying DS sessions.
I split the params change part out of Andy's respective patch and updated
it to cover this call site.  In any case, I think it might be a good idea
to make the change in the nfs41 branch although it is not strictly necessary
there as a preparation for pnfs.  If anyone objects to that, please speak
up soon :)

Benny

On Jan. 31, 2008, 13:58 +0200, Ricardo Labiaga <ricardo.labiaga at netapp.com> wrote:
> nfs4_get_sb will create a new session indirectly when creating a new
> server structure.  It may later decide not to use it.  Make sure it
> destroys the session in such case.
> 
> Need to investigate if we should move the session destroying into
> nfs4_free_server.  I don't do it at this time since it is called from
> many other places that do not currently create a session.  They should,
> and the fix will be submited in a separate patch.
> 
> Signed-off-by: Ricardo Labiaga <ricardo.labiaga at netapp.com>
> ---
>  fs/nfs/super.c |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index c3a5552..e3379fb 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -35,6 +35,7 @@
>  #include <linux/sunrpc/metrics.h>
>  #include <linux/sunrpc/xprtsock.h>
>  #include <linux/sunrpc/xprtrdma.h>
> +#include <linux/sunrpc/bc_xprt.h>
>  #include <linux/nfs_fs.h>
>  #include <linux/nfs_mount.h>
>  #include <linux/nfs4_mount.h>
> @@ -1727,6 +1728,20 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
>  	}
>  
>  	if (s->s_fs_info != server) {
> +#if defined(CONFIG_NFS_V4_1)
> +		switch (server->nfs_client->cl_minorversion) {
> +		case 1:
> +			if (server->session) {
> +				dprintk("%s Destroy session %p/%p\n",
> +					__FUNCTION__, server->session, server);
> +				nfs4_proc_destroy_session(server);
> +			}
> +			break;
> +		default:
> +			/* Fall-through */
> +			break;
> +		}
> +#endif /* CONFIG_NFS_V4_1 */
>  		nfs_free_server(server);
>  		server = s->s_fs_info;
>  	}
> @@ -1775,7 +1790,7 @@ static void nfs4_kill_super(struct super_block *sb)
>  	switch (server->nfs_client->cl_minorversion) {
>  	case 1:
>  		if (server->session) {
> -			dprintk("%s Destroy session %p for nfs_server %p\n",
> +			dprintk("%s Destroy session %p/%p\n",
>  				__FUNCTION__, server->session, server);
>  			nfs4_proc_destroy_session(server);
>  		}



More information about the pNFS mailing list