浏览代码

NFSv4: Ensure that we don't reap a delegation that is being returned

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Trond Myklebust 10 年之前
父节点
当前提交
b04b22f4ca
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      fs/nfs/delegation.c

+ 7 - 5
fs/nfs/delegation.c

@@ -815,12 +815,14 @@ restart:
 			inode = nfs_delegation_grab_inode(delegation);
 			inode = nfs_delegation_grab_inode(delegation);
 			if (inode == NULL)
 			if (inode == NULL)
 				continue;
 				continue;
-			delegation = nfs_detach_delegation(NFS_I(inode),
-					delegation, server);
+			delegation = nfs_start_delegation_return_locked(NFS_I(inode));
 			rcu_read_unlock();
 			rcu_read_unlock();
-
-			if (delegation != NULL)
-				nfs_free_delegation(delegation);
+			if (delegation != NULL) {
+				delegation = nfs_detach_delegation(NFS_I(inode),
+					delegation, server);
+				if (delegation != NULL)
+					nfs_free_delegation(delegation);
+			}
 			iput(inode);
 			iput(inode);
 			goto restart;
 			goto restart;
 		}
 		}