[PATCH -next] cifs: fix wrong unlock before return from cifs_tree_connect()

Yang Yingliang posted 1 patch 3 years, 8 months ago
fs/cifs/connect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH -next] cifs: fix wrong unlock before return from cifs_tree_connect()
Posted by Yang Yingliang 3 years, 8 months ago
It should unlock 'tcon->tc_lock' before return from cifs_tree_connect().

Fixes: fe67bd563ec2 ("cifs: avoid use of global locks for high contention data")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 fs/cifs/connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 931d4b6fafc8..1362210f3ece 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4583,7 +4583,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
 	if (tcon->ses->ses_status != SES_GOOD ||
 	    (tcon->status != TID_NEW &&
 	    tcon->status != TID_NEED_TCON)) {
-		spin_unlock(&tcon->ses->ses_lock);
+		spin_unlock(&tcon->tc_lock);
 		return 0;
 	}
 	tcon->status = TID_IN_TCON;
-- 
2.25.1
Re: [PATCH -next] cifs: fix wrong unlock before return from cifs_tree_connect()
Posted by Steve French 3 years, 8 months ago
merged into cifs-2.6.git for-next

On Fri, Jul 29, 2022 at 2:45 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> It should unlock 'tcon->tc_lock' before return from cifs_tree_connect().
>
> Fixes: fe67bd563ec2 ("cifs: avoid use of global locks for high contention data")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  fs/cifs/connect.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 931d4b6fafc8..1362210f3ece 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -4583,7 +4583,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
>         if (tcon->ses->ses_status != SES_GOOD ||
>             (tcon->status != TID_NEW &&
>             tcon->status != TID_NEED_TCON)) {
> -               spin_unlock(&tcon->ses->ses_lock);
> +               spin_unlock(&tcon->tc_lock);
>                 return 0;
>         }
>         tcon->status = TID_IN_TCON;
> --
> 2.25.1
>


-- 
Thanks,

Steve
Re: [PATCH -next] cifs: fix wrong unlock before return from cifs_tree_connect()
Posted by Shyam Prasad N 3 years, 8 months ago
On Fri, Jul 29, 2022 at 9:08 PM Steve French <smfrench@gmail.com> wrote:
>
> merged into cifs-2.6.git for-next
>
> On Fri, Jul 29, 2022 at 2:45 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> >
> > It should unlock 'tcon->tc_lock' before return from cifs_tree_connect().
> >
> > Fixes: fe67bd563ec2 ("cifs: avoid use of global locks for high contention data")
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> >  fs/cifs/connect.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> > index 931d4b6fafc8..1362210f3ece 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -4583,7 +4583,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
> >         if (tcon->ses->ses_status != SES_GOOD ||
> >             (tcon->status != TID_NEW &&
> >             tcon->status != TID_NEED_TCON)) {
> > -               spin_unlock(&tcon->ses->ses_lock);
> > +               spin_unlock(&tcon->tc_lock);
> >                 return 0;
> >         }
> >         tcon->status = TID_IN_TCON;
> > --
> > 2.25.1
> >
>
>
> --
> Thanks,
>
> Steve

Good catch. Looks good to me.

-- 
Regards,
Shyam