summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-09-20 07:23:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-11 18:18:40 +0200
commitfecdf72f6774c0c9e7c62845dfc7c9a7ea6b4816 (patch)
tree54d2eb8a162dc693d1bed0d3d6c64edac6a5c480
parentcc376abf178b7ddfb5f620a8a72d9fe048828203 (diff)
downloadlinux-stable-fecdf72f6774c0c9e7c62845dfc7c9a7ea6b4816.tar.gz
linux-stable-fecdf72f6774c0c9e7c62845dfc7c9a7ea6b4816.tar.bz2
linux-stable-fecdf72f6774c0c9e7c62845dfc7c9a7ea6b4816.zip
pNFS: Ensure we do clear the return-on-close layout stateid on fatal errors
[ Upstream commit 9c47b18cf722184f32148784189fca945a7d0561 ] 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: 1c5bd76d17cca ("pNFS: Enable layoutreturn operation for...") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/nfs/pnfs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 96867fb159bf..ec04cce31814 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1319,10 +1319,15 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
const nfs4_stateid *res_stateid = NULL;
struct nfs4_xdr_opaque_data *ld_private = args->ld_private;
- if (ret == 0) {
- arg_stateid = &args->stateid;
+ switch (ret) {
+ case -NFS4ERR_NOMATCHING_LAYOUT:
+ break;
+ case 0:
if (res->lrs_present)
res_stateid = &res->stateid;
+ /* Fallthrough */
+ default:
+ arg_stateid = &args->stateid;
}
pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range,
res_stateid);