btrfs: fix return value check of btrfs_start_transaction()
The error check of btrfs_start_transaction() is added, and the mistake of the error check on several places is corrected. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
committed by
Chris Mason
parent
5df6708348
commit
98d5dc13e7
@@ -907,6 +907,10 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
|
||||
|
||||
if (new_size > old_size) {
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
if (IS_ERR(trans)) {
|
||||
ret = PTR_ERR(trans);
|
||||
goto out_unlock;
|
||||
}
|
||||
ret = btrfs_grow_device(trans, device, new_size);
|
||||
btrfs_commit_transaction(trans, root);
|
||||
} else {
|
||||
@@ -2141,9 +2145,9 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
|
||||
path->leave_spinning = 1;
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
if (!trans) {
|
||||
if (IS_ERR(trans)) {
|
||||
btrfs_free_path(path);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(trans);
|
||||
}
|
||||
|
||||
dir_id = btrfs_super_root_dir(&root->fs_info->super_copy);
|
||||
@@ -2337,6 +2341,8 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp
|
||||
u64 transid;
|
||||
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
if (IS_ERR(trans))
|
||||
return PTR_ERR(trans);
|
||||
transid = trans->transid;
|
||||
btrfs_commit_transaction_async(trans, root, 0);
|
||||
|
||||
|
Reference in New Issue
Block a user