OSDN Git Service

NFSv4: Hold the delegation spinlock when updating the seqid
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 21 Oct 2019 18:11:00 +0000 (14:11 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Nov 2019 02:28:45 +0000 (21:28 -0500)
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/delegation.c

index e80419a..7ebeb57 100644 (file)
@@ -387,8 +387,10 @@ int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,
                /* Is this an update of the existing delegation? */
                if (nfs4_stateid_match_other(&old_delegation->stateid,
                                        &delegation->stateid)) {
+                       spin_lock(&old_delegation->lock);
                        nfs_update_inplace_delegation(old_delegation,
                                        delegation);
+                       spin_unlock(&old_delegation->lock);
                        goto out;
                }
                /*