* [PATCH] code cleanup
@ 2016-08-14 20:11 Harinath Nampally
2016-08-15 6:33 ` Omar Sandoval
0 siblings, 1 reply; 2+ messages in thread
From: Harinath Nampally @ 2016-08-14 20:11 UTC (permalink / raw)
To: linux-btrfs
This patch checks ret value and jumps to clean up in case of
btrs_add_systme_chunk call fails
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
---
fs/btrfs/volumes.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 366b335..fedb301 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4880,12 +4880,15 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
ret = btrfs_insert_item(trans, chunk_root, &key, chunk, item_size);
if (ret == 0 && map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
- /*
- * TODO: Cleanup of inserted chunk root in case of
- * failure.
- */
ret = btrfs_add_system_chunk(chunk_root, &key, chunk,
item_size);
+ if (ret) {
+ /*
+ * Cleanup of inserted chunk root in case of
+ * failure.
+ */
+ goto out;
+ }
}
out:
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] code cleanup
2016-08-14 20:11 [PATCH] code cleanup Harinath Nampally
@ 2016-08-15 6:33 ` Omar Sandoval
0 siblings, 0 replies; 2+ messages in thread
From: Omar Sandoval @ 2016-08-15 6:33 UTC (permalink / raw)
To: Harinath Nampally; +Cc: linux-btrfs
On Sun, Aug 14, 2016 at 04:11:31PM -0400, Harinath Nampally wrote:
> This patch checks ret value and jumps to clean up in case of
> btrs_add_systme_chunk call fails
>
> Signed-off-by: Harinath Nampally <harinath922@gmail.com>
> ---
> fs/btrfs/volumes.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 366b335..fedb301 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -4880,12 +4880,15 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
>
> ret = btrfs_insert_item(trans, chunk_root, &key, chunk, item_size);
> if (ret == 0 && map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
> - /*
> - * TODO: Cleanup of inserted chunk root in case of
> - * failure.
> - */
> ret = btrfs_add_system_chunk(chunk_root, &key, chunk,
> item_size);
> + if (ret) {
> + /*
> + * Cleanup of inserted chunk root in case of
> + * failure.
> + */
> + goto out;
> + }
> }
>
> out:
NAK. This patch doesn't do anything. That's just jumping to the exact
same location that we were previously returning to anyways.
--
Omar
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-15 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-14 20:11 [PATCH] code cleanup Harinath Nampally
2016-08-15 6:33 ` Omar Sandoval
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).