Commit d72b7963 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4: Fix clearing of layout segments in layoutreturn

Make sure that we clear the layout segments in cases where we see a
fatal error, and also in the case where the layout is invalid.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent a017ad13
...@@ -9998,6 +9998,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) ...@@ -9998,6 +9998,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
fallthrough; fallthrough;
default: default:
task->tk_status = 0; task->tk_status = 0;
lrp->res.lrs_present = 0;
fallthrough; fallthrough;
case 0: case 0:
break; break;
...@@ -10011,9 +10012,11 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) ...@@ -10011,9 +10012,11 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
task->tk_status = 0; task->tk_status = 0;
break; break;
case -NFS4ERR_DELAY: case -NFS4ERR_DELAY:
if (nfs4_async_handle_error(task, server, NULL, NULL) != -EAGAIN) if (nfs4_async_handle_error(task, server, NULL, NULL) ==
break; -EAGAIN)
goto out_restart; goto out_restart;
lrp->res.lrs_present = 0;
break;
} }
return; return;
out_restart: out_restart:
......
...@@ -1284,10 +1284,9 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo, ...@@ -1284,10 +1284,9 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
LIST_HEAD(freeme); LIST_HEAD(freeme);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (!pnfs_layout_is_valid(lo) || if (!nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
!nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
goto out_unlock; goto out_unlock;
if (stateid) { if (stateid && pnfs_layout_is_valid(lo)) {
u32 seq = be32_to_cpu(arg_stateid->seqid); u32 seq = be32_to_cpu(arg_stateid->seqid);
pnfs_mark_matching_lsegs_invalid(lo, &freeme, range, seq); pnfs_mark_matching_lsegs_invalid(lo, &freeme, range, seq);
......
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