NFSv4: Ensure that we don't reap a delegation that is being returned
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 26 Feb 2015 18:59:38 +0000 (13:59 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 2 Mar 2015 23:09:13 +0000 (18:09 -0500)
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/delegation.c

index 2e37d8315d9207ee2ec527dea5948a525738e245..d9caf73eef48d03fae231dfe580e564ab9ac71c2 100644 (file)
@@ -815,12 +815,14 @@ restart:
                        inode = nfs_delegation_grab_inode(delegation);
                        if (inode == NULL)
                                continue;
-                       delegation = nfs_detach_delegation(NFS_I(inode),
-                                       delegation, server);
+                       delegation = nfs_start_delegation_return_locked(NFS_I(inode));
                        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);
                        goto restart;
                }