Skip to content

Commit 7bcc105

Browse files
author
Trond Myklebust
committed
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: Trond Myklebust <[email protected]>
1 parent ae83d0b commit 7bcc105

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfs/pnfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino)
13321332
!valid_layout) {
13331333
spin_unlock(&ino->i_lock);
13341334
dprintk("NFS: %s no layout segments to return\n", __func__);
1335-
goto out_put_layout_hdr;
1335+
goto out_wait_layoutreturn;
13361336
}
13371337

13381338
send = pnfs_prepare_layoutreturn(lo, &stateid, &cred, NULL);
13391339
spin_unlock(&ino->i_lock);
13401340
if (send)
13411341
status = pnfs_send_layoutreturn(lo, &stateid, &cred, IOMODE_ANY, true);
1342+
out_wait_layoutreturn:
1343+
wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, TASK_UNINTERRUPTIBLE);
13421344
out_put_layout_hdr:
13431345
pnfs_free_lseg_list(&tmp_list);
13441346
pnfs_put_layout_hdr(lo);

0 commit comments

Comments
 (0)