diff mbox series

[07/28] lustre: lmv: try another MDT if statfs failed

Message ID 1655560330-30743-8-git-send-email-jsimmons@infradead.org (mailing list archive)
State Not Applicable
Headers show
Series lustre: sync to OpenSFS June 15, 2022 | expand

Commit Message

James Simmons June 18, 2022, 1:51 p.m. UTC
From: Alexander Boyko <alexander.boyko@hpe.com>

With lazystatfs option statfs could fail if MDT0 is offline.
This leads to MPICH->IOR fail during FOFB tests. A client
could get statfs data from different MDT at DNE setup.

HPE-bug-id: LUS-10581
WC-bug-id: https://jira.whamcloud.com/browse/LU-15788
Lustre-commit: 57f3262baa7d89311 ("LU-15788 lmv: try another MDT if statfs failed")
Signed-off-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-on: https://review.whamcloud.com/47152
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lmv/lmv_obd.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/lmv/lmv_obd.c b/fs/lustre/lmv/lmv_obd.c
index d83ba41ff..3af7a53 100644
--- a/fs/lustre/lmv/lmv_obd.c
+++ b/fs/lustre/lmv/lmv_obd.c
@@ -1233,6 +1233,7 @@  static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 	u32 i;
 	u32 idx;
 	int rc = 0;
+	int err = 0;
 
 	temp = kzalloc(sizeof(*temp), GFP_NOFS);
 	if (!temp)
@@ -1252,6 +1253,10 @@  static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 		if (rc) {
 			CERROR("%s: can't stat MDS #%d: rc = %d\n",
 			       tgt->ltd_exp->exp_obd->obd_name, i, rc);
+			err = rc;
+			/* Try another MDT */
+			if (flags & OBD_STATFS_SUM)
+				continue;
 			goto out_free_temp;
 		}
 
@@ -1266,7 +1271,7 @@  static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 			 * service
 			 */
 			*osfs = *temp;
-			break;
+			goto out_free_temp;
 		}
 
 		if (i == 0) {
@@ -1279,7 +1284,9 @@  static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 			osfs->os_granted += temp->os_granted;
 		}
 	}
-
+	/* There is no stats from some MDTs, data incomplete */
+	if (err)
+		rc = err;
 out_free_temp:
 	kfree(temp);
 	return rc;