Skip to content

Commit

Permalink
btrfs: commit transaction after setting label and features
Browse files Browse the repository at this point in the history
The set_fslabel ioctl uses btrfs_end_transaction, which means it's
possible that the change will be lost if the system crashes, same for
the newly set features. Let's use btrfs_commit_transaction instead.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Jeff Mahoney authored and Chris Mason committed Feb 9, 2014
1 parent 6cc98d9 commit d0270ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4547,7 +4547,7 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
spin_lock(&root->fs_info->super_lock);
strcpy(super_block->label, label);
spin_unlock(&root->fs_info->super_lock);
ret = btrfs_end_transaction(trans, root);
ret = btrfs_commit_transaction(trans, root);

out_unlock:
mnt_drop_write_file(file);
Expand Down Expand Up @@ -4711,7 +4711,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg)
btrfs_set_super_incompat_flags(super_block, newflags);
spin_unlock(&root->fs_info->super_lock);

return btrfs_end_transaction(trans, root);
return btrfs_commit_transaction(trans, root);
}

long btrfs_ioctl(struct file *file, unsigned int
Expand Down

0 comments on commit d0270ac

Please sign in to comment.