aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2011-01-20 01:19:37 -0500
committerChris Mason <chris.mason@oracle.com>2011-02-01 07:17:27 -0500
commit98d5dc13e7e74b77ca3b4c3cbded9f48d2dbbbb7 (patch)
tree8e75f67b28b5b0d909483a06bb5258e0ba0c9789 /fs/btrfs/volumes.c
parent5df67083488ccbad925f583b698ab38f8629a016 (diff)
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>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index f2d2f4ccc738..7cad59353b09 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1212,6 +1212,10 @@ static int btrfs_rm_dev_item(struct btrfs_root *root,
1212 return -ENOMEM; 1212 return -ENOMEM;
1213 1213
1214 trans = btrfs_start_transaction(root, 0); 1214 trans = btrfs_start_transaction(root, 0);
1215 if (IS_ERR(trans)) {
1216 btrfs_free_path(path);
1217 return PTR_ERR(trans);
1218 }
1215 key.objectid = BTRFS_DEV_ITEMS_OBJECTID; 1219 key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
1216 key.type = BTRFS_DEV_ITEM_KEY; 1220 key.type = BTRFS_DEV_ITEM_KEY;
1217 key.offset = device->devid; 1221 key.offset = device->devid;
@@ -1604,6 +1608,12 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1604 } 1608 }
1605 1609
1606 trans = btrfs_start_transaction(root, 0); 1610 trans = btrfs_start_transaction(root, 0);
1611 if (IS_ERR(trans)) {
1612 kfree(device);
1613 ret = PTR_ERR(trans);
1614 goto error;
1615 }
1616
1607 lock_chunks(root); 1617 lock_chunks(root);
1608 1618
1609 device->barriers = 1; 1619 device->barriers = 1;
@@ -1872,7 +1882,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root,
1872 return ret; 1882 return ret;
1873 1883
1874 trans = btrfs_start_transaction(root, 0); 1884 trans = btrfs_start_transaction(root, 0);
1875 BUG_ON(!trans); 1885 BUG_ON(IS_ERR(trans));
1876 1886
1877 lock_chunks(root); 1887 lock_chunks(root);
1878 1888
@@ -2046,7 +2056,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
2046 BUG_ON(ret); 2056 BUG_ON(ret);
2047 2057
2048 trans = btrfs_start_transaction(dev_root, 0); 2058 trans = btrfs_start_transaction(dev_root, 0);
2049 BUG_ON(!trans); 2059 BUG_ON(IS_ERR(trans));
2050 2060
2051 ret = btrfs_grow_device(trans, device, old_size); 2061 ret = btrfs_grow_device(trans, device, old_size);
2052 BUG_ON(ret); 2062 BUG_ON(ret);
@@ -2212,6 +2222,11 @@ again:
2212 2222
2213 /* Shrinking succeeded, else we would be at "done". */ 2223 /* Shrinking succeeded, else we would be at "done". */
2214 trans = btrfs_start_transaction(root, 0); 2224 trans = btrfs_start_transaction(root, 0);
2225 if (IS_ERR(trans)) {
2226 ret = PTR_ERR(trans);
2227 goto done;
2228 }
2229
2215 lock_chunks(root); 2230 lock_chunks(root);
2216 2231
2217 device->disk_total_bytes = new_size; 2232 device->disk_total_bytes = new_size;