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>
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;
(unsigned long long)device->devid);
}
- btrfs_register_one_device(file);
+ if (is_block_device(file))
+ btrfs_register_one_device(file);
}
raid_groups: