pnfs: send layoutcommit until IO completed when return layout
Subsystems (2)
PATCH 1/1 pnfs: send layoutcommit until IO completed when return layout
If we call layoutcommit before IO completed, then some extents we are writing may not be in the commit list. When we return layout, they may not get a chance to be committed to server.
Signed-off-by Zhang Jingwang <[email protected]>
--- fs/nfs/pnfs.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
fs/nfs/pnfs.c +10 -10
@@ -726,16 +726,6 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range, arg.length = ~0 ; }if (type ==RETURN_FILE ) { -if (nfsi->layoutcommit_ctx) { - status =pnfs_layoutcommit_inode (ino,1 ); -if (status) { -dprintk ("%s: layoutcommit failed, status=%d. " -"Returning layout anyway\n" , - __func__, status); - status =0 ; - } - } - lo =get_lock_current_layout (nfsi);if (lo && !has_layout_to_return (lo, &arg)) {put_unlock_current_layout (lo);
@@ -763,6 +753,16 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,wait_event (nfsi->lo_waitq, !pnfs_return_layout_barrier (nfsi, &arg)); } + +if (nfsi->layoutcommit_ctx) { + status =pnfs_layoutcommit_inode (ino,1 ); +if (status) { +dprintk ("%s: layoutcommit failed, status=%d. " +"Returning layout anyway\n" , + __func__, status); + status =0 ; + } + } } send_return: status =return_layout (ino, &arg, stateid, type, lo);
Signature · 1 line
1.6.2.5
Quoted 34 lines · Zhang Jingwang
If we call layoutcommit before IO completed, then some extents we are writing may not be in the commit list. When we return layout, they may not get a chance to be committed to server.
Signed-off-by Zhang Jingwang <[email protected]>--- fs/nfs/pnfs.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)fs/nfs/pnfs.c +0
-10@@ -726,16 +726,6 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range, arg.length = ~0 ; }if (type ==RETURN_FILE ) { -if (nfsi->layoutcommit_ctx) { - status =pnfs_layoutcommit_inode (ino,1 ); -if (status) { -dprintk ("%s: layoutcommit failed, status=%d. " -"Returning layout anyway\n" , - __func__, status); - status =0 ; - } - } - lo =get_lock_current_layout (nfsi);if (lo && !has_layout_to_return (lo, &arg)) {put_unlock_current_layout (lo);@@ -763,6 +753,16 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,wait_event (nfsi->lo_waitq, !pnfs_return_layout_barrier (nfsi, &arg)); }
fs/nfs/pnfs.c _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range, · line 765
Quoted 10 lines
fs/nfs/pnfs.c +10
-0+ +if (nfsi->layoutcommit_ctx) { + status =pnfs_layoutcommit_inode (ino,1 ); +if (status) { +dprintk ("%s: layoutcommit failed, status=%d. " +"Returning layout anyway\n" , + __func__, status); + status =0 ; + } + }
OK, I guess doing that after the send_return label is superfluous as there should be nothing to layoutcommit if we got there after finding no layout to return.
Benny
Quoted 3 lines
fs/nfs/pnfs.c +0
-0} send_return: status =return_layout (ino, &arg, stateid, type, lo);