Skip to content

Commit d72b796

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
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: Trond Myklebust <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent a017ad1 commit d72b796

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

fs/nfs/nfs4proc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9998,6 +9998,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
99989998
fallthrough;
99999999
default:
1000010000
task->tk_status = 0;
10001+
lrp->res.lrs_present = 0;
1000110002
fallthrough;
1000210003
case 0:
1000310004
break;
@@ -10011,9 +10012,11 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
1001110012
task->tk_status = 0;
1001210013
break;
1001310014
case -NFS4ERR_DELAY:
10014-
if (nfs4_async_handle_error(task, server, NULL, NULL) != -EAGAIN)
10015-
break;
10016-
goto out_restart;
10015+
if (nfs4_async_handle_error(task, server, NULL, NULL) ==
10016+
-EAGAIN)
10017+
goto out_restart;
10018+
lrp->res.lrs_present = 0;
10019+
break;
1001710020
}
1001810021
return;
1001910022
out_restart:

fs/nfs/pnfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,10 +1284,9 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
12841284
LIST_HEAD(freeme);
12851285

12861286
spin_lock(&inode->i_lock);
1287-
if (!pnfs_layout_is_valid(lo) ||
1288-
!nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
1287+
if (!nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
12891288
goto out_unlock;
1290-
if (stateid) {
1289+
if (stateid && pnfs_layout_is_valid(lo)) {
12911290
u32 seq = be32_to_cpu(arg_stateid->seqid);
12921291

12931292
pnfs_mark_matching_lsegs_invalid(lo, &freeme, range, seq);

0 commit comments

Comments
 (0)