Skip to content

Commit 9c47b18

Browse files
trondmyamschuma-ntap
authored andcommitted
pNFS: Ensure we do clear the return-on-close layout stateid on fatal errors
IF the server rejected our layout return with a state error such as NFS4ERR_BAD_STATEID, or even a stale inode error, then we do want to clear out all the remaining layout segments and mark that stateid as invalid. Fixes: 1c5bd76 ("pNFS: Enable layoutreturn operation for...") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 581057c commit 9c47b18

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/nfs/pnfs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,10 +1449,15 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
14491449
const nfs4_stateid *res_stateid = NULL;
14501450
struct nfs4_xdr_opaque_data *ld_private = args->ld_private;
14511451

1452-
if (ret == 0) {
1453-
arg_stateid = &args->stateid;
1452+
switch (ret) {
1453+
case -NFS4ERR_NOMATCHING_LAYOUT:
1454+
break;
1455+
case 0:
14541456
if (res->lrs_present)
14551457
res_stateid = &res->stateid;
1458+
/* Fallthrough */
1459+
default:
1460+
arg_stateid = &args->stateid;
14561461
}
14571462
pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range,
14581463
res_stateid);

0 commit comments

Comments
 (0)