btrfs: sysfs label interface should check for read only FS
authorAnand Jain <Anand.Jain@oracle.com>
Wed, 30 Jul 2014 12:04:10 +0000 (20:04 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:38:01 +0000 (13:38 -0700)
Not sure how this escaped many eyes so far

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/sysfs.c

index e6a5e7d..b2e7bb4 100644 (file)
@@ -377,6 +377,9 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
        int ret;
        size_t p_len;
 
+       if (fs_info->sb->s_flags & MS_RDONLY)
+               return -EROFS;
+
        /*
         * p_len is the len until the first occurrence of either
         * '\n' or '\0'