NFSv4.1/pnfs: Ensure we send layoutcommit before return-on-close
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 25 Mar 2015 16:36:13 +0000 (12:36 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 27 Mar 2015 16:39:38 +0000 (12:39 -0400)
We must not send a close or delegreturn that would result in a
return-on-close of the layout without ensuring that we've also
sent the necessary layoutcommit.

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

index ea83f3c03c65a37fbbaa3900158c016ad367fe30..c2ce2db771b7d2f2d47d57ea74e10fe7950e0d1e 100644 (file)
@@ -1090,6 +1090,7 @@ bool pnfs_roc(struct inode *ino)
        pnfs_get_layout_hdr(lo); /* matched in pnfs_roc_release */
        spin_unlock(&ino->i_lock);
        pnfs_free_lseg_list(&tmp_list);
+       pnfs_layoutcommit_inode(ino, true);
        return true;
 
 out_noroc:
@@ -1104,8 +1105,10 @@ out_noroc:
                }
        }
        spin_unlock(&ino->i_lock);
-       if (layoutreturn)
+       if (layoutreturn) {
+               pnfs_layoutcommit_inode(ino, true);
                pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true);
+       }
        return false;
 }