From: Andreas Dilger Date: Sun, 12 Jun 2022 19:44:50 +0000 (-0700) Subject: LU-15647 utils: 'lfs df' shouldn't loop forever X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=c94bbdfe9e19996015ab188f475f84941af25808;p=fs%2Flustre-release.git LU-15647 utils: 'lfs df' shouldn't loop forever Don't loop forever in "lfs df" if there is a problem fetching the target statfs information from the kernel and -ENODEV is not returned for whatever reason. Lustre-change: https://review.whamcloud.com/46813 Lustre-commit: 41703e9b5fe7061b313805384b08372d4fe82cec Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I5110c7246cf53eb5c4d59424a44b73b9d23ebbe5 Reviewed-by: Jian Yu Reviewed-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/47605 Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index e2e0abb..b958c5e 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -6331,13 +6331,14 @@ static int mntdf(char *mntdir, char *fsname, char *pool, enum mntdf_flags flags, if (!(tp->st_op & ops)) continue; - for (index = 0; ; index++) { + for (index = 0; index < LOV_ALL_STRIPES && + (!lsb || lsb->sb_count < LL_STATFS_MAX); index++) { memset(&stat_buf, 0, sizeof(struct obd_statfs)); memset(&uuid_buf, 0, sizeof(struct obd_uuid)); type = flags & MNTDF_LAZY ? tp->st_op | LL_STATFS_NODELAY : tp->st_op; rc2 = llapi_obd_fstatfs(fd, type, index, - &stat_buf, &uuid_buf); + &stat_buf, &uuid_buf); if (rc2 == -ENODEV) break; if (rc2 == -EAGAIN)