2012-12-24 10:49:39

by Yanchuan Nian

[permalink] [raw]
Subject: [PATCH] nfsd: Don't unlock the state while it's not locked

From: Yanchuan Nian <[email protected]>

In the procedure of CREATE_SESSION, the state is locked after
alloc_conn_from_crses(). If the allocation fails, the function
goes to "out_free_session", and then "out" where there is an
unlock function.

Signed-off-by: Yanchuan Nian <[email protected]>

---
fs/nfsd/nfs4state.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 29924a0..cc41bf4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1844,11 +1844,12 @@ nfsd4_create_session(struct svc_rqst *rqstp,

/* cache solo and embedded create sessions under the state lock */
nfsd4_cache_create_session(cr_ses, cs_slot, status);
-out:
nfs4_unlock_state();
+out:
dprintk("%s returns %d\n", __func__, ntohl(status));
return status;
out_free_conn:
+ nfs4_unlock_state();
free_conn(conn);
out_free_session:
__free_session(new);
--
1.7.4.4



2013-01-03 00:39:59

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] nfsd: Don't unlock the state while it's not locked

On Mon, Dec 24, 2012 at 06:11:45PM +0800, [email protected] wrote:
> From: Yanchuan Nian <[email protected]>
>
> In the procedure of CREATE_SESSION, the state is locked after
> alloc_conn_from_crses(). If the allocation fails, the function
> goes to "out_free_session", and then "out" where there is an
> unlock function.

Thanks, applying for 3.9.--b.

>
> Signed-off-by: Yanchuan Nian <[email protected]>
>
> ---
> fs/nfsd/nfs4state.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 29924a0..cc41bf4 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1844,11 +1844,12 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>
> /* cache solo and embedded create sessions under the state lock */
> nfsd4_cache_create_session(cr_ses, cs_slot, status);
> -out:
> nfs4_unlock_state();
> +out:
> dprintk("%s returns %d\n", __func__, ntohl(status));
> return status;
> out_free_conn:
> + nfs4_unlock_state();
> free_conn(conn);
> out_free_session:
> __free_session(new);
> --
> 1.7.4.4
>