Btrfs: fail mount on bad mount options
authorSage Weil <sage@newdream.net>
Sat, 7 Nov 2009 06:19:16 +0000 (06:19 +0000)
committerChris Mason <chris.mason@oracle.com>
Thu, 17 Dec 2009 17:33:36 +0000 (12:33 -0500)
We shouldn't silently ignore unrecognized options.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/super.c

index 270cc96b9a43b83f0d4e7af07d7b5fc46d4010a0..193d920e54eb3d80e5c2942833bca1ec635ef593 100644 (file)
@@ -128,6 +128,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
        substring_t args[MAX_OPT_ARGS];
        char *p, *num;
        int intarg;
+       int ret = 0;
 
        if (!options)
                return 0;
@@ -262,12 +263,18 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                case Opt_discard:
                        btrfs_set_opt(info->mount_opt, DISCARD);
                        break;
+               case Opt_err:
+                       printk(KERN_INFO "btrfs: unrecognized mount option "
+                              "'%s'\n", p);
+                       ret = -EINVAL;
+                       goto out;
                default:
                        break;
                }
        }
+out:
        kfree(options);
-       return 0;
+       return ret;
 }
 
 /*