Thread (4 messages) 4 messages, 2 authors, 2023-01-19
STALE1248d

[PATCH 1/1] pNFS/filelayout: treat GETDEVICEINFO errors as LAYOUTUNAVAILABLE

From: Olga Kornievskaia <hidden>
Date: 2023-01-19 17:50:22
Subsystem: filesystems (vfs and infrastructure), nfs, sunrpc, and lockd clients, the rest · Maintainers: Alexander Viro, Christian Brauner, Trond Myklebust, Anna Schumaker, Linus Torvalds

If the call to GETDEVICEINFO fails, the client fallback to doing IO
to MDS but on every new IO call, the client tries to get the device
again. Instead, mark the layout as unavailable as well. This way
the client will re-try after a timeout period.

Signed-off-by: Olga Kornievskaia <redacted>
---
 fs/nfs/filelayout/filelayout.c | 1 +
 fs/nfs/pnfs.c                  | 7 +++++++
 fs/nfs/pnfs.h                  | 2 ++
 3 files changed, 10 insertions(+)
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 4974cd18ca46..13df85457cf5 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -862,6 +862,7 @@ fl_pnfs_update_layout(struct inode *ino,
 
 	status = filelayout_check_deviceid(lo, fl, gfp_flags);
 	if (status) {
+		pnfs_mark_layout_unavailable(lo, iomode);
 		pnfs_put_lseg(lseg);
 		lseg = NULL;
 	}
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a5db5158c634..bac15dcf99bb 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -491,6 +491,13 @@ pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
 		refcount_inc(&lo->plh_refcount);
 }
 
+void
+pnfs_mark_layout_unavailable(struct pnfs_layout_hdr *lo, enum pnfs_iomode fail_bit)
+{
+	pnfs_layout_set_fail_bit(lo, pnfs_iomode_to_fail_bit(fail_bit));
+}
+EXPORT_SYMBOL_GPL(pnfs_mark_layout_unavailable);
+
 static void
 pnfs_layout_clear_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
 {
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index e3e6a41f19de..9f47bd883fc3 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -343,6 +343,8 @@ void pnfs_error_mark_layout_for_return(struct inode *inode,
 void pnfs_layout_return_unused_byclid(struct nfs_client *clp,
 				      enum pnfs_iomode iomode);
 
+void pnfs_mark_layout_unavailable(struct pnfs_layout_hdr *lo,
+				  enum pnfs_iomode iomode);
 /* nfs4_deviceid_flags */
 enum {
 	NFS_DEVICEID_INVALID = 0,       /* set when MDS clientid recalled */
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help