Commit 2e84611b authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix an rcu lock leak

The intention in the original patch was to release the lock when
we put the inode, however something got screwed up.
Reported-by: default avatarJason Yan <yanaijie@huawei.com>
Fixes: 7b410d9c ("pNFS: Delay getting the layout header in..")
Cc: stable@vger.kernel.org # v4.10+
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 0795bf83
...@@ -131,10 +131,11 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp, ...@@ -131,10 +131,11 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
if (!inode) if (!inode)
continue; continue;
if (!nfs_sb_active(inode->i_sb)) { if (!nfs_sb_active(inode->i_sb)) {
rcu_read_lock(); rcu_read_unlock();
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
iput(inode); iput(inode);
spin_lock(&clp->cl_lock); spin_lock(&clp->cl_lock);
rcu_read_lock();
goto restart; goto restart;
} }
return inode; return inode;
...@@ -170,10 +171,11 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp, ...@@ -170,10 +171,11 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
if (!inode) if (!inode)
continue; continue;
if (!nfs_sb_active(inode->i_sb)) { if (!nfs_sb_active(inode->i_sb)) {
rcu_read_lock(); rcu_read_unlock();
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
iput(inode); iput(inode);
spin_lock(&clp->cl_lock); spin_lock(&clp->cl_lock);
rcu_read_lock();
goto restart; goto restart;
} }
return inode; return inode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment