summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-01-21 23:11:42 +0100
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-01-25 02:52:30 +0100
commit08bd8dbe88825760e953759d7ec212903a026c75 (patch)
tree5018659dd3b807789a1d4fdda3388bdba0e91a27 /fs/nfs
parentpNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process() (diff)
downloadlinux-08bd8dbe88825760e953759d7ec212903a026c75.tar.xz
linux-08bd8dbe88825760e953759d7ec212903a026c75.zip
pNFS/NFSv4: Try to return invalid layout in pnfs_layout_process()
If the server returns a new stateid that does not match the one in our cache, then try to return the one we hold instead of just invalidating it on the client side. This ensures that both client and server will agree that the stateid is invalid. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-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 e68e6f8cb407..d6262289cf4a 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2398,7 +2398,13 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
* We got an entirely new state ID. Mark all segments for the
* inode invalid, and retry the layoutget
*/
- pnfs_mark_layout_stateid_invalid(lo, &free_me);
+ struct pnfs_layout_range range = {
+ .iomode = IOMODE_ANY,
+ .length = NFS4_MAX_UINT64,
+ };
+ pnfs_set_plh_return_info(lo, IOMODE_ANY, 0);
+ pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs,
+ &range, 0);
goto out_forget;
}
@@ -2417,7 +2423,6 @@ out_forget:
spin_unlock(&ino->i_lock);
lseg->pls_layout = lo;
NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
- pnfs_free_lseg_list(&free_me);
return ERR_PTR(-EAGAIN);
}