Skip to contentSkip to conversation

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

PATCH New [email protected] 1 participant 1 message Apr 20, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

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

From: Trond Myklebust <[email protected]>

We require that any outstanding layout return completes before we can free up the inode so that the layout itself can be freed.

---
 fs/nfs/pnfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/pnfs.c +3 -1
index b8d78f393365..3bf6899cba95 100644
@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino)
 			!valid_layout) {
 		spin_unlock(&ino->i_lock);
 		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);
 	spin_unlock(&ino->i_lock);
 	if (send)
 		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:
 	pnfs_free_lseg_list(&tmp_list);
 	pnfs_put_layout_hdr(lo);
Signature · 1 line
2.25.3