diff mbox

btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs

Message ID 1527971171-49824-1-git-send-email-yevgenyp@pointgrab.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yevgeny Popovych June 2, 2018, 8:26 p.m. UTC
When traverse_directory() encounters an inode item that already exists
and has a normal amount of hardlinks - it just continues with a next one,
w/o clearing the ret value (set to -EEXIST).

But, if the last file traverse_directory() processes already has an
inode item - traverse_directory() will silently exit with a
bad return code, causing the prints like the following:

    unable to traverse directory initial-directory: 1
    error wihle filling filesystem: 1

Fix this by clearing ret value before continuing with a next file.

Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com>
---
 mkfs/rootdir.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba June 6, 2018, 2:54 p.m. UTC | #1
On Sat, Jun 02, 2018 at 11:26:11PM +0300, Yevgeny Popovych wrote:
> When traverse_directory() encounters an inode item that already exists
> and has a normal amount of hardlinks - it just continues with a next one,
> w/o clearing the ret value (set to -EEXIST).
> 
> But, if the last file traverse_directory() processes already has an
> inode item - traverse_directory() will silently exit with a
> bad return code, causing the prints like the following:
> 
>     unable to traverse directory initial-directory: 1
>     error wihle filling filesystem: 1
> 
> Fix this by clearing ret value before continuing with a next file.
> 
> Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com>

Thanks, there was a fix for that in pull request 124 and is in the devel
branch already.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c
index ff00bb0..834aacc 100644
--- a/mkfs/rootdir.c
+++ b/mkfs/rootdir.c
@@ -553,6 +553,7 @@  static int traverse_directory(struct btrfs_trans_handle *trans,
 						(unsigned long)st.st_nlink);
 					goto fail;
 				}
+				ret = 0;
 				continue;
 			}
 			if (ret) {