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
@@ -1212,6 +1212,10 @@ static int btrfs_rm_dev_item(struct btrfs_root *root,
|
||||
return -ENOMEM;
|
||||
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
if (IS_ERR(trans)) {
|
||||
btrfs_free_path(path);
|
||||
return PTR_ERR(trans);
|
||||
}
|
||||
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
||||
key.type = BTRFS_DEV_ITEM_KEY;
|
||||
key.offset = device->devid;
|
||||
@@ -1604,6 +1608,12 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
|
||||
}
|
||||
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
if (IS_ERR(trans)) {
|
||||
kfree(device);
|
||||
ret = PTR_ERR(trans);
|
||||
goto error;
|
||||
}
|
||||
|
||||
lock_chunks(root);
|
||||
|
||||
device->barriers = 1;
|
||||
@@ -1872,7 +1882,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root,
|
||||
return ret;
|
||||
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
BUG_ON(!trans);
|
||||
BUG_ON(IS_ERR(trans));
|
||||
|
||||
lock_chunks(root);
|
||||
|
||||
@@ -2046,7 +2056,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
|
||||
BUG_ON(ret);
|
||||
|
||||
trans = btrfs_start_transaction(dev_root, 0);
|
||||
BUG_ON(!trans);
|
||||
BUG_ON(IS_ERR(trans));
|
||||
|
||||
ret = btrfs_grow_device(trans, device, old_size);
|
||||
BUG_ON(ret);
|
||||
@@ -2212,6 +2222,11 @@ again:
|
||||
|
||||
/* Shrinking succeeded, else we would be at "done". */
|
||||
trans = btrfs_start_transaction(root, 0);
|
||||
if (IS_ERR(trans)) {
|
||||
ret = PTR_ERR(trans);
|
||||
goto done;
|
||||
}
|
||||
|
||||
lock_chunks(root);
|
||||
|
||||
device->disk_total_bytes = new_size;
|
||||
|
Reference in New Issue
Block a user