diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2011-08-09 03:11:13 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-08-16 21:09:15 -0400 |
commit | cb1b69f4508a1e8c1a7907379eafceb7ae0325ef (patch) | |
tree | 2ea242702f3ee814543c3101ddc86a9b97877cf5 /fs | |
parent | cdcb725c05fe0cb71777c66ddc2445fedbbb3c59 (diff) |
Btrfs: forced readonly when btrfs_drop_snapshot() fails
The filesystem turns readonly instead of returning the error to the
caller when detected error in btrfs_drop_snapshot().
and, because the caller doesn't check the error, the function type is
changed to 'void'.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 4 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 22 |
2 files changed, 16 insertions, 10 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index a6263bdab818..884293642a6c 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2367,8 +2367,8 @@ static inline int btrfs_insert_empty_item(struct btrfs_trans_handle *trans, | |||
2367 | int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path); | 2367 | int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path); |
2368 | int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); | 2368 | int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); |
2369 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); | 2369 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); |
2370 | int btrfs_drop_snapshot(struct btrfs_root *root, | 2370 | void btrfs_drop_snapshot(struct btrfs_root *root, |
2371 | struct btrfs_block_rsv *block_rsv, int update_ref); | 2371 | struct btrfs_block_rsv *block_rsv, int update_ref); |
2372 | int btrfs_drop_subtree(struct btrfs_trans_handle *trans, | 2372 | int btrfs_drop_subtree(struct btrfs_trans_handle *trans, |
2373 | struct btrfs_root *root, | 2373 | struct btrfs_root *root, |
2374 | struct extent_buffer *node, | 2374 | struct extent_buffer *node, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a3e71b59f66e..80d6148f60ac 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -6277,8 +6277,8 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans, | |||
6277 | * also make sure backrefs for the shared block and all lower level | 6277 | * also make sure backrefs for the shared block and all lower level |
6278 | * blocks are properly updated. | 6278 | * blocks are properly updated. |
6279 | */ | 6279 | */ |
6280 | int btrfs_drop_snapshot(struct btrfs_root *root, | 6280 | void btrfs_drop_snapshot(struct btrfs_root *root, |
6281 | struct btrfs_block_rsv *block_rsv, int update_ref) | 6281 | struct btrfs_block_rsv *block_rsv, int update_ref) |
6282 | { | 6282 | { |
6283 | struct btrfs_path *path; | 6283 | struct btrfs_path *path; |
6284 | struct btrfs_trans_handle *trans; | 6284 | struct btrfs_trans_handle *trans; |
@@ -6291,13 +6291,16 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
6291 | int level; | 6291 | int level; |
6292 | 6292 | ||
6293 | path = btrfs_alloc_path(); | 6293 | path = btrfs_alloc_path(); |
6294 | if (!path) | 6294 | if (!path) { |
6295 | return -ENOMEM; | 6295 | err = -ENOMEM; |
6296 | goto out; | ||
6297 | } | ||
6296 | 6298 | ||
6297 | wc = kzalloc(sizeof(*wc), GFP_NOFS); | 6299 | wc = kzalloc(sizeof(*wc), GFP_NOFS); |
6298 | if (!wc) { | 6300 | if (!wc) { |
6299 | btrfs_free_path(path); | 6301 | btrfs_free_path(path); |
6300 | return -ENOMEM; | 6302 | err = -ENOMEM; |
6303 | goto out; | ||
6301 | } | 6304 | } |
6302 | 6305 | ||
6303 | trans = btrfs_start_transaction(tree_root, 0); | 6306 | trans = btrfs_start_transaction(tree_root, 0); |
@@ -6326,7 +6329,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
6326 | path->lowest_level = 0; | 6329 | path->lowest_level = 0; |
6327 | if (ret < 0) { | 6330 | if (ret < 0) { |
6328 | err = ret; | 6331 | err = ret; |
6329 | goto out; | 6332 | goto out_free; |
6330 | } | 6333 | } |
6331 | WARN_ON(ret > 0); | 6334 | WARN_ON(ret > 0); |
6332 | 6335 | ||
@@ -6433,11 +6436,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
6433 | free_extent_buffer(root->commit_root); | 6436 | free_extent_buffer(root->commit_root); |
6434 | kfree(root); | 6437 | kfree(root); |
6435 | } | 6438 | } |
6436 | out: | 6439 | out_free: |
6437 | btrfs_end_transaction_throttle(trans, tree_root); | 6440 | btrfs_end_transaction_throttle(trans, tree_root); |
6438 | kfree(wc); | 6441 | kfree(wc); |
6439 | btrfs_free_path(path); | 6442 | btrfs_free_path(path); |
6440 | return err; | 6443 | out: |
6444 | if (err) | ||
6445 | btrfs_std_error(root->fs_info, err); | ||
6446 | return; | ||
6441 | } | 6447 | } |
6442 | 6448 | ||
6443 | /* | 6449 | /* |