[LU-15647] "lfs df" should not loop indefinitely for new MDTs/OSTs Created: 13/Mar/22  Updated: 05/Jul/22  Resolved: 11/Jun/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0, Lustre 2.15.1

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: Andreas Dilger
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

The inner loop in lfs_df->mntdf() iterating over MDTs and OSTs will run forever if ENODEV is not returned, even if other errors are returned:

        for (tp = types; tp->st_name != NULL; tp++) {
                bool have_ost = false;

                if (!(tp->st_op & ops))
                        continue;

                for (index = 0; ; index++) {
                       rc2 = llapi_obd_fstatfs(fd, type, index, &stat_buf, &uuid_buf);
                        if (rc2 == -ENODEV)
                                break;
                        if (rc2 == -EAGAIN)
                                continue;
                        if (rc2 == -ENODATA) { /* Inactive device, OK. */
                                if (!(flags & MNTDF_VERBOSE))
                                        continue;
                        } else if (rc2 < 0 && rc == 0) {
                                rc = rc2;
                        }
                        :
                }
        }

The inner loop should be limited to a maximum index of LOV_ALL_STRIPES (to avoid looping forever) and a maximum of LL_STATFS_MAX actual targets (to avoid overflowing the lsb->sb_buf[] array).



 Comments   
Comment by Gerrit Updater [ 13/Mar/22 ]

"Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/46813
Subject: LU-15647 utils: 'lfs df' shouldn't loop forever
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 9b0bc34ab7d99c71e129aee799e29c83b87054f3

Comment by Gerrit Updater [ 11/Jun/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/46813/
Subject: LU-15647 utils: 'lfs df' shouldn't loop forever
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 41703e9b5fe7061b313805384b08372d4fe82cec

Comment by Peter Jones [ 11/Jun/22 ]

Landed for 2.16

Comment by Gerrit Updater [ 24/Jun/22 ]

"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/47734
Subject: LU-15647 utils: 'lfs df' shouldn't loop forever
Project: fs/lustre-release
Branch: b2_15
Current Patch Set: 1
Commit: 1a57d75f679274504895046d468d427f366eead7

Comment by Gerrit Updater [ 05/Jul/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/47734/
Subject: LU-15647 utils: 'lfs df' shouldn't loop forever
Project: fs/lustre-release
Branch: b2_15
Current Patch Set:
Commit: ca05e79686313c9d92dfeb235591a13eed7c1c90

Generated at Sat Feb 10 03:20:07 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.