pNFS: Ensure nfs4_layoutget_prepare returns the correct error
Subsystems (2)
PATCH 1/2 pNFS: Ensure nfs4_layoutget_prepare returns the correct error
If we're unable to perform the layoutget due to an invalid open stateid or a bulk recall, ensure that we return the error so that the caller can decide on an appropriate action.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/nfs4proc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/nfs/nfs4proc.c +5 -4
@@ -7776,6 +7776,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)struct nfs4_layoutget *lgp = calldata;struct nfs_server *server =NFS_SERVER (lgp->args.inode);struct nfs4_session *session =nfs4_get_session (server); +int ret;dprintk ("--> %s\n" , __func__);/* Note the is a race here, where a CB_LAYOUTRECALL can come in
@@ -7786,12 +7787,12 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)if (nfs41_setup_sequence (session, &lgp->args.seq_args, &lgp->res.seq_res, task))return ; -if (pnfs_choose_layoutget_stateid (&lgp->args.stateid, + ret =pnfs_choose_layoutget_stateid (&lgp->args.stateid,NFS_I (lgp->args.inode)->layout, &lgp->args.range, - lgp->args.ctx->state)) { -rpc_exit (task,NFS4_OK ); - } + lgp->args.ctx->state); +if (ret <0 ) +rpc_exit (task, ret); }static void nfs4_layoutget_done (struct rpc_task *task,void *calldata)
Signature · 1 line
2.5.0
PATCH 2/2 pNFS: If we have to delay the layout callback, mark the layout for return
If the client needs to delay the layout callback, then speed up the recall process by marking the remaining layout segments to be actively returned by the client.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/callback_proc.c | 3 +++ fs/nfs/pnfs.c | 4 +++- fs/nfs/pnfs.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-)
fs/nfs/callback_proc.c +3 -0
@@ -184,6 +184,9 @@ static u32 initiate_file_draining(struct nfs_client *clp,if (test_bit (NFS_LAYOUT_BULK_RECALL , &lo->plh_flags) ||pnfs_mark_matching_lsegs_invalid (lo, &free_me_list, &args->cbl_range)) { +pnfs_mark_matching_lsegs_return (lo, + &free_me_list, + &args->cbl_range); rv =NFS4ERR_DELAY ; goto unlock; }
fs/nfs/pnfs.c +3 -1
@@ -1733,7 +1733,7 @@ out_forget_reply: goto out; } -static void +void pnfs_mark_matching_lsegs_return (struct pnfs_layout_hdr *lo,struct list_head *tmp_list,struct pnfs_layout_range *return_range)
@@ -1745,6 +1745,8 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,if (list_empty (&lo->plh_segs))return ; +assert_spin_locked (&lo->plh_inode->i_lock); +list_for_each_entry_safe (lseg, next, &lo->plh_segs, pls_list)if (should_free_lseg (&lseg->pls_range, return_range)) { dprintk("%s: marking lseg %p iomode %d "
fs/nfs/pnfs.h +3 -0
@@ -265,6 +265,9 @@ int pnfs_choose_layoutget_stateid(nfs4_stateid *dst,int pnfs_mark_matching_lsegs_invalid (struct pnfs_layout_hdr *lo,struct list_head *tmp_list,struct pnfs_layout_range *recall_range); +void pnfs_mark_matching_lsegs_return (struct pnfs_layout_hdr *lo, +struct list_head *tmp_list, +struct pnfs_layout_range *recall_range);bool pnfs_roc (struct inode *ino);void pnfs_roc_release (struct inode *ino);void pnfs_roc_set_barrier (struct inode *ino,u32 barrier);
Signature · 1 line
2.5.0