]> git.hungrycats.org Git - linux/commitdiff
NFSv4: Fix an rcu lock leak
authorTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 5 May 2017 17:02:42 +0000 (13:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:46:30 +0000 (15:46 +0200)
commit 2e84611b3f4fa50e1f4c12f2966fcc7fb955d944 upstream.

The intention in the original patch was to release the lock when
we put the inode, however something got screwed up.

Reported-by: Jason Yan <yanaijie@huawei.com>
Fixes: 7b410d9ce460f ("pNFS: Delay getting the layout header in..")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/callback_proc.c

index f073a6d2c6a51a4ec91cf38783519ca957bdece4..d582d443c21a2a77c0616a0080b90d9f63b48ba6 100644 (file)
@@ -131,10 +131,11 @@ restart:
                        if (!inode)
                                continue;
                        if (!nfs_sb_active(inode->i_sb)) {
-                               rcu_read_lock();
+                               rcu_read_unlock();
                                spin_unlock(&clp->cl_lock);
                                iput(inode);
                                spin_lock(&clp->cl_lock);
+                               rcu_read_lock();
                                goto restart;
                        }
                        return inode;
@@ -170,10 +171,11 @@ restart:
                        if (!inode)
                                continue;
                        if (!nfs_sb_active(inode->i_sb)) {
-                               rcu_read_lock();
+                               rcu_read_unlock();
                                spin_unlock(&clp->cl_lock);
                                iput(inode);
                                spin_lock(&clp->cl_lock);
+                               rcu_read_lock();
                                goto restart;
                        }
                        return inode;