Skip to contentSkip to conversation

NFSv4: Fix an rcu lock leak

PATCH In review Trond Myklebust 2 participants 2 messages May 5, 2017 – May 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Fixes 7b410d9ce460f ("pNFS: Delay getting the layout header in..")
Cc [email protected] # v4.10+
---
 fs/nfs/callback_proc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/callback_proc.c +4 -2
index e7f041447afd..52479f180ea1 100644
@@ -131,10 +131,11 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
 			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 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
 			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;
Signature · 1 line
2.9.3