Commit 7bcc1058 authored by Trond Myklebust's avatar Trond Myklebust

NFS/pnfs: Ensure that _pnfs_return_layout() waits for layoutreturn completion

We require that any outstanding layout return completes before we can
free up the inode so that the layout itself can be freed.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent ae83d0b4
...@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino) ...@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino)
!valid_layout) { !valid_layout) {
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
dprintk("NFS: %s no layout segments to return\n", __func__); dprintk("NFS: %s no layout segments to return\n", __func__);
goto out_put_layout_hdr; goto out_wait_layoutreturn;
} }
send = pnfs_prepare_layoutreturn(lo, &stateid, &cred, NULL); send = pnfs_prepare_layoutreturn(lo, &stateid, &cred, NULL);
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
if (send) if (send)
status = pnfs_send_layoutreturn(lo, &stateid, &cred, IOMODE_ANY, true); status = pnfs_send_layoutreturn(lo, &stateid, &cred, IOMODE_ANY, true);
out_wait_layoutreturn:
wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, TASK_UNINTERRUPTIBLE);
out_put_layout_hdr: out_put_layout_hdr:
pnfs_free_lseg_list(&tmp_list); pnfs_free_lseg_list(&tmp_list);
pnfs_put_layout_hdr(lo); pnfs_put_layout_hdr(lo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment