projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Btrfs: fix how we deal with the pages array in the write path
[deliverable/linux.git]
/
fs
/
btrfs
/
volumes.c
diff --git
a/fs/btrfs/volumes.c
b/fs/btrfs/volumes.c
index d158530233b701397360fa13be8265274589b896..dd13eb81ee4011df4d52103665d30465fe696306 100644
(file)
--- a/
fs/btrfs/volumes.c
+++ b/
fs/btrfs/volumes.c
@@
-1213,6
+1213,10
@@
static int btrfs_rm_dev_item(struct btrfs_root *root,
return -ENOMEM;
trans = btrfs_start_transaction(root, 0);
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;
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
key.type = BTRFS_DEV_ITEM_KEY;
key.offset = device->devid;
@@
-1334,11
+1338,11
@@
int btrfs_rm_device(struct btrfs_root *root, char *device_path)
ret = btrfs_shrink_device(device, 0);
if (ret)
ret = btrfs_shrink_device(device, 0);
if (ret)
- goto error_
brelse
;
+ goto error_
undo
;
ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device);
if (ret)
ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device);
if (ret)
- goto error_
brelse
;
+ goto error_
undo
;
device->in_fs_metadata = 0;
device->in_fs_metadata = 0;
@@
-1412,6
+1416,13
@@
out:
mutex_unlock(&root->fs_info->volume_mutex);
mutex_unlock(&uuid_mutex);
return ret;
mutex_unlock(&root->fs_info->volume_mutex);
mutex_unlock(&uuid_mutex);
return ret;
+error_undo:
+ if (device->writeable) {
+ list_add(&device->dev_alloc_list,
+ &root->fs_info->fs_devices->alloc_list);
+ root->fs_info->fs_devices->rw_devices++;
+ }
+ goto error_brelse;
}
/*
}
/*
@@
-1601,11
+1612,19
@@
int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
ret = find_next_devid(root, &device->devid);
if (ret) {
ret = find_next_devid(root, &device->devid);
if (ret) {
+ kfree(device->name);
kfree(device);
goto error;
}
trans = btrfs_start_transaction(root, 0);
kfree(device);
goto error;
}
trans = btrfs_start_transaction(root, 0);
+ if (IS_ERR(trans)) {
+ kfree(device->name);
+ kfree(device);
+ ret = PTR_ERR(trans);
+ goto error;
+ }
+
lock_chunks(root);
device->writeable = 1;
lock_chunks(root);
device->writeable = 1;
@@
-1621,7
+1640,7
@@
int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
device->dev_root = root->fs_info->dev_root;
device->bdev = bdev;
device->in_fs_metadata = 1;
device->dev_root = root->fs_info->dev_root;
device->bdev = bdev;
device->in_fs_metadata = 1;
- device->mode =
0
;
+ device->mode =
FMODE_EXCL
;
set_blocksize(device->bdev, 4096);
if (seeding_dev) {
set_blocksize(device->bdev, 4096);
if (seeding_dev) {
@@
-1873,7
+1892,7
@@
static int btrfs_relocate_chunk(struct btrfs_root *root,
return ret;
trans = btrfs_start_transaction(root, 0);
return ret;
trans = btrfs_start_transaction(root, 0);
- BUG_ON(
!trans
);
+ BUG_ON(
IS_ERR(trans)
);
lock_chunks(root);
lock_chunks(root);
@@
-2047,7
+2066,7
@@
int btrfs_balance(struct btrfs_root *dev_root)
BUG_ON(ret);
trans = btrfs_start_transaction(dev_root, 0);
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);
ret = btrfs_grow_device(trans, device, old_size);
BUG_ON(ret);
@@
-2213,6
+2232,11
@@
again:
/* Shrinking succeeded, else we would be at "done". */
trans = btrfs_start_transaction(root, 0);
/* 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;
lock_chunks(root);
device->disk_total_bytes = new_size;
This page took
0.032426 seconds
and
5
git commands to generate.