Thread (16 messages) 16 messages, 2 authors, 2016-08-24
STALE3609d

[PATCH 10/13] btrfs-progs: mkfs: switch BUG_ON to error handling in traverse_directory

From: David Sterba <dsterba@suse.com>
Date: 2016-08-23 10:43:45
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: David Sterba <dsterba@suse.com>
---
 mkfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mkfs.c b/mkfs.c
index 3f0a3322cc76..c28a8bb7e983 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -910,7 +910,12 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
 					      parent_inum, dir_index_cnt,
 					      &cur_inode);
 			if (ret == -EEXIST) {
-				BUG_ON(st.st_nlink <= 1);
+				if (st.st_nlink <= 1) {
+					error(
+			"item %s already exists but has wrong st_nlink %ld <= 1",
+						cur_file->d_name, st.st_nlink);
+					goto fail;
+				}
 				continue;
 			}
 			if (ret) {
-- 
2.7.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help