Message ID | 1471205491-27411-1-git-send-email-harinath922@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
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.
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:
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(-)