pNFS: LAYOUTRETURN should only update the stateid if the layout is valid
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 24 Jul 2016 16:26:34 +0000 (12:26 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 24 Jul 2016 16:51:49 +0000 (12:51 -0400)
If the layout was completely returned, then ignore the returned layout
stateid.

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

index ff416d0e24bc25215a991c282e8ae19a65d31832..dc50ba4d84adf17b4ac75c4c8ead9eed2535dede 100644 (file)
@@ -8130,7 +8130,7 @@ static void nfs4_layoutreturn_release(void *calldata)
        pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range,
                        be32_to_cpu(lrp->args.stateid.seqid));
        pnfs_mark_layout_returned_if_empty(lo);
-       if (lrp->res.lrs_present)
+       if (lrp->res.lrs_present && pnfs_layout_is_valid(lo))
                pnfs_set_layout_stateid(lo, &lrp->res.stateid, true);
        pnfs_clear_layoutreturn_waitbit(lo);
        spin_unlock(&lo->plh_inode->i_lock);
index b21bd0bee784391b0b88483d9b9d3ee7cce91bde..2f4f26905c03768761c3ef54e745667c815fe350 100644 (file)
@@ -375,6 +375,11 @@ static inline bool nfs_have_layout(struct inode *inode)
        return NFS_I(inode)->layout != NULL;
 }
 
+static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
+{
+       return test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) == 0;
+}
+
 static inline struct nfs4_deviceid_node *
 nfs4_get_deviceid(struct nfs4_deviceid_node *d)
 {
This page took 0.027178 seconds and 5 git commands to generate.