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