Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 105d736c57b2691635bd047efe146ef0 > files > 3

btrfs-progs-0.20-0.rc1.20130117.2.mga3.src.rpm

From 133e4520eab88ee11b31afa4cbb012afdb0bbc28 Mon Sep 17 00:00:00 2001
From: Arne Jansen <sensille@gmx.net>
Date: Tue, 29 Nov 2011 08:40:28 +0100
Subject: [PATCH] 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 <sensille@gmx.net>
---
 cmds-scrub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds-scrub.c b/cmds-scrub.c
index b864b2b..b188996 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -1002,7 +1002,7 @@ static int scrub_fs_info(char *path,
 	}
 
 	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.8.1.5