diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e6a5e7d82f4286da251e6b00b4ccb4a936b6c055..b2e7bb4393f65cf17575dadc2686a693d83bd253 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -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'