]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS/pnfs: Fix dereference of layout cred in pnfs_layoutcommit_inode()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 2 Apr 2020 19:47:08 +0000 (15:47 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 3 Apr 2020 22:29:10 +0000 (18:29 -0400)
Ensure that the dereference of the layout cred is atomic with the
stateid.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/pnfs.c

index 6fcf26b168163304367f1478c3b30b661e029646..84029c9b2b1bbe8788cb0ca91b36d05b789bf6b7 100644 (file)
@@ -3137,10 +3137,10 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
        end_pos = nfsi->layout->plh_lwb;
 
        nfs4_stateid_copy(&data->args.stateid, &nfsi->layout->plh_stateid);
+       data->cred = get_cred(nfsi->layout->plh_lc_cred);
        spin_unlock(&inode->i_lock);
 
        data->args.inode = inode;
-       data->cred = get_cred(nfsi->layout->plh_lc_cred);
        nfs_fattr_init(&data->fattr);
        data->args.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask;
        data->res.fattr = &data->fattr;