From: David Sterba Date: Fri, 23 Jan 2015 17:43:31 +0000 (+0100) Subject: btrfs: add read-only check to sysfs handler of features X-Git-Tag: v4.5.7~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=296f8da334a009ea2ec8112c2a1ac318872eff87;p=thirdparty%2Fkernel%2Fstable.git btrfs: add read-only check to sysfs handler of features commit ee6111386a1b304f8bf589d36810d53e3b27ee20 upstream. We don't want to trigger the change on a read-only filesystem, similar to what the label handler does. Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 539e7b5e3f86a..6a6bb600b1ff4 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -120,6 +120,9 @@ static ssize_t btrfs_feature_attr_store(struct kobject *kobj, if (!fs_info) return -EPERM; + if (fs_info->sb->s_flags & MS_RDONLY) + return -EROFS; + ret = kstrtoul(skip_spaces(buf), 0, &val); if (ret) return ret;