btrfs: replace BUG in can_modify_feature
authorDavid Sterba <dsterba@suse.cz>
Tue, 19 Nov 2013 12:36:21 +0000 (13:36 +0100)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:41 +0000 (13:19 -0800)
We don't need to crash hard here, it's just reading a sysfs file. The
values considered in switch are from a fixed set, the default case
should not happen at all.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/sysfs.c

index 8fdc0520e298e1eee88baf62cc558c1445bd4fd2..b535285642dc2739d5447433c5ee24d52dafff36 100644 (file)
@@ -75,7 +75,9 @@ static int can_modify_feature(struct btrfs_feature_attr *fa)
                clear = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR;
                break;
        default:
-               BUG();
+               printk(KERN_WARNING "btrfs: sysfs: unknown feature set %d\n",
+                               fa->feature_set);
+               return 0;
        }
 
        if (set & fa->feature_bit)