Lustre master 2.17.57_dirty does not display per-OST quota
information when OST indices are sparse or start at a high index.
The filesystem has eight OSTs with indices 256 through 263:
256: himfs-OST0100_UUID ACTIVE
...
263: himfs-OST0107_UUID ACTIVE
The following command displays the global quota and MDT entries, but
does not display any OST entries:
lfs quota -v -hg 1000 /himfs
It also reports:
Total allocated block limit: 0k
The command exits with rc=0.
Querying an OST explicitly works:
lfs quota --ost 256 -hg 1000 /himfs
Root cause:
print_obd_quota() calls llapi_get_obd_count(), which returns the number
of targets. It then incorrectly uses the loop counter as the target
index:
for (i = 0; i < count; i++)
qctl->qc_idx = i;
With eight OSTs at indices 256 through 263, this queries nonexistent
indices 0 through 7. ENODEV is ignored, so the command returns success
without displaying OST quota information.
The actual target indices should be obtained with
llapi_get_target_uuids() and used for qc_idx.
The same count-versus-index assumption is also present in
lfs_reset_quota() and should be corrected by the same change.
Expected result:
lfs quota -v should display all configured OSTs regardless of whether
their indices are contiguous or start at zero.