pnfs: force a layout commit when encountering busy segments during recall
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Sep 2014 15:23:29 +0000 (08:23 -0700)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 10 Sep 2014 19:47:02 +0000 (12:47 -0700)
Expedite layout recall processing by forcing a layout commit when
we see busy segments.  Without it the layout recall might have to wait
until the VM decided to start writeback for the file, which can introduce
long delays.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/callback_proc.c
fs/nfs/pnfs.c

index 41db5258e7a7a5ef837ebd11ae605f7144bd4e65..0d269515c64db917305f79a7ebe64491dfe8a5ef 100644 (file)
@@ -171,6 +171,13 @@ static u32 initiate_file_draining(struct nfs_client *clp,
                goto out;
 
        ino = lo->plh_inode;
+
+       spin_lock(&ino->i_lock);
+       pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
+       spin_unlock(&ino->i_lock);
+
+       pnfs_layoutcommit_inode(ino, false);
+
        spin_lock(&ino->i_lock);
        if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
            pnfs_mark_matching_lsegs_invalid(lo, &free_me_list,
@@ -178,7 +185,6 @@ static u32 initiate_file_draining(struct nfs_client *clp,
                rv = NFS4ERR_DELAY;
        else
                rv = NFS4ERR_NOMATCHING_LAYOUT;
-       pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
        spin_unlock(&ino->i_lock);
        pnfs_free_lseg_list(&free_me_list);
        pnfs_put_layout_hdr(lo);
index 8827ab130ed3c33301e7b428b39fc784910e77b3..ce5d1ea695d16678b0f7a3ddab68a1cd0ef5f385 100644 (file)
@@ -594,6 +594,9 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
                dprintk("%s freeing layout for inode %lu\n", __func__,
                        lo->plh_inode->i_ino);
                inode = lo->plh_inode;
+
+               pnfs_layoutcommit_inode(inode, false);
+
                spin_lock(&inode->i_lock);
                list_del_init(&lo->plh_bulk_destroy);
                lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */