diff options
author | David Sterba <dsterba@suse.cz> | 2015-06-06 02:17:13 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-06-08 17:50:46 +0200 |
commit | 1bcedaae799d117957e36f8ffddc0d9d84274c2d (patch) | |
tree | 0db3fc17d8b0a27b1cb9787a0359c08e34e45c3a | |
parent | 49ac5f50b5d466c92be25c83aa354c64c1f00ca3 (diff) |
btrfs-progs: mkfs: do not try to register non-block-devices
A mkfs on a regular file will try to call the DEV_SCAN ioctl that will
take the loop through the kernel and fail:
ERROR: device scan failed './test.img' - Block device required
If a user without permission to open the control device tries to mkfs a
regular file, an error message is printed:
failed to open /dev/btrfs-control skipping device registration: Permission denied
So we should not try to pass a non-block-device besides that this makes
the --quiet option more quiet.
Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r-- | mkfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1482,7 +1482,8 @@ int main(int ac, char **av) trans = btrfs_start_transaction(root, 1); - btrfs_register_one_device(file); + if (is_block_device(file)) + btrfs_register_one_device(file); if (dev_cnt == 0) goto raid_groups; @@ -1531,7 +1532,8 @@ int main(int ac, char **av) (unsigned long long)device->devid); } - btrfs_register_one_device(file); + if (is_block_device(file)) + btrfs_register_one_device(file); } raid_groups: |