linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: add missing error checks to add_data_references
@ 2013-07-13 11:25 Filipe David Borba Manana
  2013-07-18 17:16 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Filipe David Borba Manana @ 2013-07-13 11:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe David Borba Manana

The function relocation.c:add_data_references() was not checking
if all calls to __add_tree_block() and find_data_references() were
succeeding or not.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 fs/btrfs/relocation.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 1209649..295a611 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3628,7 +3628,7 @@ int add_data_references(struct reloc_control *rc,
 	unsigned long ptr;
 	unsigned long end;
 	u32 blocksize = btrfs_level_size(rc->extent_root, 0);
-	int ret;
+	int ret = 0;
 	int err = 0;
 
 	eb = path->nodes[0];
@@ -3655,6 +3655,10 @@ int add_data_references(struct reloc_control *rc,
 		} else {
 			BUG();
 		}
+		if (ret) {
+			err = ret;
+			goto out;
+		}
 		ptr += btrfs_extent_inline_ref_size(key.type);
 	}
 	WARN_ON(ptr > end);
@@ -3700,6 +3704,7 @@ int add_data_references(struct reloc_control *rc,
 		}
 		path->slots[0]++;
 	}
+out:
 	btrfs_release_path(path);
 	if (err)
 		free_block_list(blocks);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Btrfs: add missing error checks to add_data_references
  2013-07-13 11:25 [PATCH] Btrfs: add missing error checks to add_data_references Filipe David Borba Manana
@ 2013-07-18 17:16 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2013-07-18 17:16 UTC (permalink / raw)
  To: Filipe David Borba Manana; +Cc: linux-btrfs

On Sat, Jul 13, 2013 at 12:25:15PM +0100, Filipe David Borba Manana wrote:
> The function relocation.c:add_data_references() was not checking
> if all calls to __add_tree_block() and find_data_references() were
> succeeding or not.
> 
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.cz>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-18 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-13 11:25 [PATCH] Btrfs: add missing error checks to add_data_references Filipe David Borba Manana
2013-07-18 17:16 ` David Sterba

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).