If lfs prints a nul char, it breaks parsing of the output.
Fixes:
68635c3d9b31 ("LU-11963 osd: Add nonrotational flag to statfs")
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ibfa77920adf3a6c62b01efb005d02ca81db7f7c1
Reviewed-on: https://review.whamcloud.com/35137
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
static char obd_statfs_state2char(int s)
{
static char obd_statfs_state2char(int s)
{
- /* Not an error state, do not print here */
- if (s == OS_STATE_NONROT)
- return '\0';
/* Unknown name */
if (s > ARRAY_SIZE(obd_statfs_state_names)/sizeof(char) ||
obd_statfs_state_names[s] == 0)
/* Unknown name */
if (s > ARRAY_SIZE(obd_statfs_state_names)/sizeof(char) ||
obd_statfs_state_names[s] == 0)
printf(" ");
for (i = 0, state = stat->os_state; state != 0; i++) {
uint32_t mask = 1 << i;
printf(" ");
for (i = 0, state = stat->os_state; state != 0; i++) {
uint32_t mask = 1 << i;
+ if (!(state & mask) || mask == OS_STATE_NONROT)
continue;
printf("%c", obd_statfs_state2char(mask));
state &= ~mask;
continue;
printf("%c", obd_statfs_state2char(mask));
state &= ~mask;