pNFS: Ensure we commit the layout if it has been invalidated
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 29 Apr 2017 14:10:17 +0000 (10:10 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 29 Apr 2017 15:29:30 +0000 (11:29 -0400)
If the layout is being invalidated on the server, then we must
invoke nfs_commit_inode() to ensure any commits to the DS get
cleared out.

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

index c81c61971625d873f9c8cf6319edbc875618a3ab..87f5b7b971caa3243ae739dcdeb84b8b64e0502f 100644 (file)
@@ -379,6 +379,7 @@ nfs42_layoutstat_done(struct rpc_task *task, void *calldata)
                        pnfs_mark_layout_stateid_invalid(lo, &head);
                        spin_unlock(&inode->i_lock);
                        pnfs_free_lseg_list(&head);
+                       nfs_commit_inode(inode, 0);
                } else
                        spin_unlock(&inode->i_lock);
                break;
index c2b82caa9068ccf4b41ad1dbead3334f050932ca..158c3d52146f1629fd40cf6b6941b7a5d022987d 100644 (file)
@@ -8330,6 +8330,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task,
                 */
                pnfs_mark_layout_stateid_invalid(lo, &head);
                spin_unlock(&inode->i_lock);
+               nfs_commit_inode(inode, 0);
                pnfs_free_lseg_list(&head);
                status = -EAGAIN;
                goto out;
index 6c2e4c73684c35ed356ea88beb87aa54b9e5fd95..140ecd7d350fa523450951958b613f51927b084c 100644 (file)
@@ -727,6 +727,7 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
                pnfs_layout_clear_fail_bit(lo, NFS_LAYOUT_RW_FAILED);
                spin_unlock(&nfsi->vfs_inode.i_lock);
                pnfs_free_lseg_list(&tmp_list);
+               nfs_commit_inode(&nfsi->vfs_inode, 0);
                pnfs_put_layout_hdr(lo);
        } else
                spin_unlock(&nfsi->vfs_inode.i_lock);
@@ -1989,6 +1990,8 @@ out_forget:
        spin_unlock(&ino->i_lock);
        lseg->pls_layout = lo;
        NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
+       if (!pnfs_layout_is_valid(lo))
+               nfs_commit_inode(ino, 0);
        return ERR_PTR(-EAGAIN);
 }