[pnfs] [PATCH] pnfs: call destroy session in nfs4_put_session
William A. (Andy) Adamson
andros at citi.umich.edu
Wed May 21 09:35:08 EDT 2008
On Wed, May 21, 2008 at 7:24 AM, Benny Halevy <bhalevy at panasas.com> wrote:
> On May. 20, 2008, 23:30 +0300, andros at netapp.com wrote:
> > From: Andy Adamson <andros at netapp.com>
> >
> > Initialize session state to expired; it is set to valid upon successful
> > CREATE_SESSION.
> >
> > If session has not been expired, call DESTROY_SESSION before freeing the
> > session, and before shutting down the rpc_clnt.
> >
> > Signed-off-by: Andy Adamson<andros at netapp.com>
> > ---
> > fs/nfs/client.c | 16 ++++++++--------
> > fs/nfs/nfs4proc.c | 4 ++++
> > 2 files changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> > index 34c50e4..bb8acb3 100644
> > --- a/fs/nfs/client.c
> > +++ b/fs/nfs/client.c
> > @@ -861,14 +861,6 @@ void nfs_free_server(struct nfs_server *server)
> > list_del(&server->master_link);
> > spin_unlock(&nfs_client_lock);
> >
> > - if (server->destroy != NULL)
> > - server->destroy(server);
> > -
> > - if (!IS_ERR(server->client_acl))
> > - rpc_shutdown_client(server->client_acl);
> > - if (!IS_ERR(server->client))
> > - rpc_shutdown_client(server->client);
> > -
> > #ifdef CONFIG_NFS_V4_1
> > if (server->session != NULL) {
> > /*
> > @@ -879,6 +871,14 @@ void nfs_free_server(struct nfs_server *server)
> > }
> > #endif /* CONFIG_NFS_V4_1 */
> >
> > + if (server->destroy != NULL)
> > + server->destroy(server);
> > +
> > + if (!IS_ERR(server->client_acl))
> > + rpc_shutdown_client(server->client_acl);
> > + if (!IS_ERR(server->client))
> > + rpc_shutdown_client(server->client);
> > +
> > nfs_put_client(server->nfs_client);
> >
> > nfs_free_iostats(server->io_stats);
> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> > index 7f3553a..c32b606 100644
> > --- a/fs/nfs/nfs4proc.c
> > +++ b/fs/nfs/nfs4proc.c
> > @@ -4790,6 +4790,8 @@ struct nfs4_session *nfs4_alloc_session(void)
> > spin_lock_init(&session->session_lock);
> > atomic_set(&session->ref_count, 1);
> >
> > + /* state will be set to valid in create session */
> > + nfs41_set_session_expired(session);
>
> That's already done right before the call to INIT_LIST_HEAD.
Yes it is. I'll resend an updated patch.
-->Andy
>
>
> > nfs4_init_channel(&session->fore_channel);
> > return session;
> > }
> > @@ -4804,6 +4806,8 @@ void nfs4_put_session(struct nfs4_session
> **session)
> > {
> > dprintk("--> nfs4_put_session()\n");
> > if (atomic_dec_and_test(&((*session)->ref_count))) {
> > + if (!nfs41_test_session_expired(*session))
> > + nfs4_proc_destroy_session(*session,
> (*session)->clnt);
> > nfs4_destroy_slot_table(&((*session)->fore_channel));
> > nfs4_free_session(*session);
> > *session = NULL;
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20080521/bfc1fc1e/attachment.htm
More information about the pNFS
mailing list