From patchwork Sat Jun 2 20:26:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Popovych X-Patchwork-Id: 10444997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B53F0602BC for ; Sat, 2 Jun 2018 20:26:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EC9628AC6 for ; Sat, 2 Jun 2018 20:26:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67C9A28ACE; Sat, 2 Jun 2018 20:26:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD58728AC6 for ; Sat, 2 Jun 2018 20:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750892AbeFBU0V (ORCPT ); Sat, 2 Jun 2018 16:26:21 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34337 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbeFBU0U (ORCPT ); Sat, 2 Jun 2018 16:26:20 -0400 Received: by mail-wm0-f68.google.com with SMTP id q4-v6so10369534wmq.1 for ; Sat, 02 Jun 2018 13:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pointgrab-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=LiBaF8M59YwLbkrOCfpzBKjUURY7jv3XRfxO5c8MXQw=; b=cuvEiL7zyMn0HWgfj++ItWMbjxShsRIjvFpdTWkyK65EmD2wm0twqkgmxx3Rpfls2r Q+REcY2QEP7xmRM1lvrc1QA6YafdwN/yrb12ubCQRht2s5AhryJF7QVGuf+Ax0EXrY/y 4VVBcHyM5uxL5zWRO+33cpmq1HCnaDvR7FMpm4zu8PfvvfUOtXexBI8gV8YX2jNEuap+ Kw7nzHw2mUyDArxkVQ3K9AByMgx7gfGYLNd5WlM2EB+TSutaLAdryISezq4s43h6OKdN dnNJ09LhE7MidVivvc9mIi/yTiBY26cMXJHXekMmuwb6ZTAYYOPyxmEXFe5zg0hb+NyM 7/fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LiBaF8M59YwLbkrOCfpzBKjUURY7jv3XRfxO5c8MXQw=; b=Tolf6fT3OcRUpVYnmhsMQT/FESHHCleMU7XGX4O2dZgL3DD4yPhhrwQxil4LO8exN9 tVpo3BlMa2bAzGLBlXbR1G2vVwISRIpXRES3Tf5gqvyHWQdJZDVwW4Yj1mhuKYLAVRov ZtB1SZDMdpMaBU8Xyf7qAx1CCGSlR6GoWxGnQPX00oTcVR9lPDn7KNKGlCSUM8wRVMqV XV9VGLtFen/MwYN97oUkEFG60LvmAQpkaieKq7hEGOCk5a++VULYk8evlQj/qvAFldsu pMpQKAM03ieo8nhf6J/CiVtYe77yE60eClRqJ8ZBzAftFr6o8oMhrc5dP089fuS16shv NZ3w== X-Gm-Message-State: APt69E1Z2gt8tD/0FVFFYMmjumyhJVhUnPGyULEkMN6LaUhrFm6WyvPq bjHzwjzstvBt0FZOnoWqSesaw3lKYwQ= X-Google-Smtp-Source: ADUXVKLHbVtL9GMVCyNOlcTWnzEI0+6hzhJvasyRJ4uzex/5SYWB0JGlbhWkMuzRht9y+aRaWoEPdw== X-Received: by 2002:a1c:ed07:: with SMTP id l7-v6mr15895wmh.139.1527971179391; Sat, 02 Jun 2018 13:26:19 -0700 (PDT) Received: from localhost.localdomain ([2a02:70:0:9:bdf0:af66:b584:4e8b]) by smtp.gmail.com with ESMTPSA id u70-v6sm4726598wmd.3.2018.06.02.13.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Jun 2018 13:26:18 -0700 (PDT) From: Yevgeny Popovych To: linux-btrfs@vger.kernel.org Cc: Yevgeny Popovych Subject: [PATCH] btrfs-progs: mkfs: Fix traverse_directory() silently failing on some dirs Date: Sat, 2 Jun 2018 23:26:11 +0300 Message-Id: <1527971171-49824-1-git-send-email-yevgenyp@pointgrab.com> X-Mailer: git-send-email 2.7.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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) {