@@ -976,6 +976,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
u64 transid;
u64 total_devices;
u64 bytenr;
+ u64 features;
/*
* we would like to check all the supers, but that would make
@@ -996,6 +997,15 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super))
goto error_bdev_put;
+ features = btrfs_super_incompat_flags(disk_super) &
+ ~BTRFS_FEATURE_INCOMPAT_SUPP;
+ if (features) {
+ printk(KERN_ERR \
+ "BTRFS: couldn't scan, unsupported optional features (%Lx)\n",
+ features);
+ ret = -EOPNOTSUPP;
+ goto error_disk_super;
+ }
devid = btrfs_stack_device_id(&disk_super->dev_item);
transid = btrfs_super_generation(disk_super);
total_devices = btrfs_super_num_devices(disk_super);
@@ -1010,6 +1020,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
if (!ret && fs_devices_ret)
(*fs_devices_ret)->total_devices = total_devices;
+error_disk_super:
btrfs_release_disk_super(page);
error_bdev_put:
For the matter of completeness we need to check if the device being scanned has features that are known to the kernel. As of now if it doesn't - the mount will fails, then what is the point in having those devices added to the btrfs_fs_devices list at device_list_add(). So block those devices at scan. Which means the original block at open_ctee() won't reach in case of device with unsupported feature. But I am leaving that code as it is. without deleting. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- fs/btrfs/volumes.c | 11 +++++++++++ 1 file changed, 11 insertions(+)