btrfs-progs: fix check of running scrub
Scrub on multiple devices may report wrong status if scrub finishes early on one of them. Reported-by: Sandy McArthur Jr <sandymac@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
2b7cdab425
commit
e1ee8b2a0f
|
@ -1073,15 +1073,11 @@ static int is_scrub_running_in_kernel(int fd,
|
||||||
memset(&sp, 0, sizeof(sp));
|
memset(&sp, 0, sizeof(sp));
|
||||||
sp.scrub_args.devid = di_args[i].devid;
|
sp.scrub_args.devid = di_args[i].devid;
|
||||||
ret = ioctl(fd, BTRFS_IOC_SCRUB_PROGRESS, &sp.scrub_args);
|
ret = ioctl(fd, BTRFS_IOC_SCRUB_PROGRESS, &sp.scrub_args);
|
||||||
if (ret < 0 && errno == ENODEV)
|
|
||||||
continue;
|
|
||||||
if (ret < 0 && errno == ENOTCONN)
|
|
||||||
return 0;
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const cmd_scrub_start_usage[];
|
static const char * const cmd_scrub_start_usage[];
|
||||||
|
|
Loading…
Reference in New Issue