pNFS: Ensure we check layout validity before marking it for return
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 27 Apr 2017 19:30:00 +0000 (15:30 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 28 Apr 2017 17:07:01 +0000 (13:07 -0400)
pnfs_error_mark_layout_for_return needs to check that the layout is
valid before calling pnfs_set_plh_return_info().

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

index eff266ea813c67d5d0b52cc9ff2a77d7c2902a91..e45b3ffeda084e790d897a8f9307dc2345379d56 100644 (file)
@@ -2049,6 +2049,10 @@ void pnfs_error_mark_layout_for_return(struct inode *inode,
        bool return_now = false;
 
        spin_lock(&inode->i_lock);
+       if (!pnfs_layout_is_valid(lo)) {
+               spin_unlock(&inode->i_lock);
+               return;
+       }
        pnfs_set_plh_return_info(lo, range.iomode, 0);
        /* Block LAYOUTGET */
        set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags);