aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-21 13:49:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-21 13:49:22 -0400
commit07be1337b9e8bfcd855c6e9175b5066a30ac609b (patch)
treee40ad01dc89f6eb17d461939b809fea3387fc2a5 /fs/btrfs/sysfs.c
parent63d222b9d277c4d7bf08afd1631a7f8e327a825c (diff)
parentc315ef8d9db7f1a0ebd023a395ebdfde1c68057e (diff)
Merge branch 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs updates from Chris Mason: "This has our merge window series of cleanups and fixes. These target a wide range of issues, but do include some important fixes for qgroups, O_DIRECT, and fsync handling. Jeff Mahoney moved around a few definitions to make them easier for userland to consume. Also whiteout support is included now that issues with overlayfs have been cleared up. I have one more fix pending for page faults during btrfs_copy_from_user, but I wanted to get this bulk out the door first" * 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (90 commits) btrfs: fix memory leak during RAID 5/6 device replacement Btrfs: add semaphore to synchronize direct IO writes with fsync Btrfs: fix race between block group relocation and nocow writes Btrfs: fix race between fsync and direct IO writes for prealloc extents Btrfs: fix number of transaction units for renames with whiteout Btrfs: pin logs earlier when doing a rename exchange operation Btrfs: unpin logs if rename exchange operation fails Btrfs: fix inode leak on failure to setup whiteout inode in rename btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT Btrfs: pin log earlier when renaming Btrfs: unpin log if rename operation fails Btrfs: don't do unnecessary delalloc flushes when relocating Btrfs: don't wait for unrelated IO to finish before relocation Btrfs: fix empty symlink after creating symlink and fsync parent dir Btrfs: fix for incorrect directory entries after fsync log replay btrfs: build fixup for qgroup_account_snapshot btrfs: qgroup: Fix qgroup accounting when creating snapshot Btrfs: fix fspath error deallocation btrfs: make find_workspace warn if there are no workspaces btrfs: make find_workspace always succeed ...
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 539e7b5e3f86..4879656bda3c 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,
120 if (!fs_info) 120 if (!fs_info)
121 return -EPERM; 121 return -EPERM;
122 122
123 if (fs_info->sb->s_flags & MS_RDONLY)
124 return -EROFS;
125
123 ret = kstrtoul(skip_spaces(buf), 0, &val); 126 ret = kstrtoul(skip_spaces(buf), 0, &val);
124 if (ret) 127 if (ret)
125 return ret; 128 return ret;
@@ -364,7 +367,13 @@ static ssize_t btrfs_label_show(struct kobject *kobj,
364{ 367{
365 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 368 struct btrfs_fs_info *fs_info = to_fs_info(kobj);
366 char *label = fs_info->super_copy->label; 369 char *label = fs_info->super_copy->label;
367 return snprintf(buf, PAGE_SIZE, label[0] ? "%s\n" : "%s", label); 370 ssize_t ret;
371
372 spin_lock(&fs_info->super_lock);
373 ret = snprintf(buf, PAGE_SIZE, label[0] ? "%s\n" : "%s", label);
374 spin_unlock(&fs_info->super_lock);
375
376 return ret;
368} 377}
369 378
370static ssize_t btrfs_label_store(struct kobject *kobj, 379static ssize_t btrfs_label_store(struct kobject *kobj,
@@ -374,6 +383,9 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
374 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 383 struct btrfs_fs_info *fs_info = to_fs_info(kobj);
375 size_t p_len; 384 size_t p_len;
376 385
386 if (!fs_info)
387 return -EPERM;
388
377 if (fs_info->sb->s_flags & MS_RDONLY) 389 if (fs_info->sb->s_flags & MS_RDONLY)
378 return -EROFS; 390 return -EROFS;
379 391