linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs
@ 2018-06-02 20:26 Yevgeny Popovych
  2018-06-06 14:54 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Yevgeny Popovych @ 2018-06-02 20:26 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Yevgeny Popovych

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(+)

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) {
-- 
2.7.4


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

* Re: [PATCH] btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs
  2018-06-02 20:26 [PATCH] btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs Yevgeny Popovych
@ 2018-06-06 14:54 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-06-06 14:54 UTC (permalink / raw)
  To: Yevgeny Popovych; +Cc: linux-btrfs

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.

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

end of thread, other threads:[~2018-06-06 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02 20:26 [PATCH] btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs Yevgeny Popovych
2018-06-06 14:54 ` 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).