From d439a663a5ba789f7542163317264a6b4dbbe3f2 Mon Sep 17 00:00:00 2001 From: Arne Jansen Date: Tue, 29 Nov 2011 08:40:28 +0100 Subject: [PATCH 138/138] Btrfs-progs: bugfix for scrubbing single devices Scrub can be invoked to scrub only a single device of a (mounted) filesystem. The code determines whether the given path is a mountpoint of a filesystem by issueing a btrfs-specific ioctl to it. Only in case of EINVAL it assumed it may be a device, all other errnos just caused it fail, but some devices (correctly) return ENOTTY. This patch adds this to the error check. Signed-off-by: Arne Jansen --- scrub.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scrub.c b/scrub.c index 66761c5..5b0bf16 100644 --- a/scrub.c +++ b/scrub.c @@ -987,7 +987,7 @@ static int scrub_fs_info(int fd, char *path, memset(fi_args, 0, sizeof(*fi_args)); ret = ioctl(fd, BTRFS_IOC_FS_INFO, fi_args); - if (ret && errno == EINVAL) { + if (ret && (errno == EINVAL || errno == ENOTTY)) { /* path is no mounted btrfs. try if it's a device */ ret = check_mounted_where(fd, path, mp, sizeof(mp), &fs_devices_mnt); -- 1.7.6.233.gd79bc