diff options
author | David Sterba <dsterba@suse.cz> | 2014-05-30 19:29:05 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-11-12 16:53:15 +0100 |
commit | a6f69dc8018dbb4ce2009ccba49b53f68c8bdc64 (patch) | |
tree | 19636e48cb2486764abcd934aba16fbb0e880866 /fs/btrfs | |
parent | 0eae2747ec1ddcef5018827bce8f7d33b7d920e1 (diff) | |
download | linux-a6f69dc8018dbb4ce2009ccba49b53f68c8bdc64.tar.gz linux-a6f69dc8018dbb4ce2009ccba49b53f68c8bdc64.tar.bz2 linux-a6f69dc8018dbb4ce2009ccba49b53f68c8bdc64.zip |
btrfs: move commit out of sysfs when changing label
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/sysfs.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 226f7261533a..92db3f648df4 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -369,9 +369,6 @@ static ssize_t btrfs_label_store(struct kobject *kobj, const char *buf, size_t len) { struct btrfs_fs_info *fs_info = to_fs_info(kobj); - struct btrfs_trans_handle *trans; - struct btrfs_root *root = fs_info->fs_root; - int ret; size_t p_len; if (fs_info->sb->s_flags & MS_RDONLY) @@ -386,20 +383,18 @@ static ssize_t btrfs_label_store(struct kobject *kobj, if (p_len >= BTRFS_LABEL_SIZE) return -EINVAL; - trans = btrfs_start_transaction(root, 0); - if (IS_ERR(trans)) - return PTR_ERR(trans); - - spin_lock(&root->fs_info->super_lock); + spin_lock(&fs_info->super_lock); memset(fs_info->super_copy->label, 0, BTRFS_LABEL_SIZE); memcpy(fs_info->super_copy->label, buf, p_len); - spin_unlock(&root->fs_info->super_lock); - ret = btrfs_commit_transaction(trans, root); + spin_unlock(&fs_info->super_lock); - if (!ret) - return len; + /* + * We don't want to do full transaction commit from inside sysfs + */ + btrfs_set_pending(fs_info, COMMIT); + wake_up_process(fs_info->transaction_kthread); - return ret; + return len; } BTRFS_ATTR_RW(label, btrfs_label_show, btrfs_label_store); |