From patchwork Tue Apr 3 08:39:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10320819 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 089F360318 for ; Tue, 3 Apr 2018 08:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E96EF28996 for ; Tue, 3 Apr 2018 08:34:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD934289FA; Tue, 3 Apr 2018 08:34:23 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 4776428996 for ; Tue, 3 Apr 2018 08:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754961AbeDCIeW (ORCPT ); Tue, 3 Apr 2018 04:34:22 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:35113 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755164AbeDCIeV (ORCPT ); Tue, 3 Apr 2018 04:34:21 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="38500615" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 Apr 2018 16:34:18 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 6514F48AE77D; Tue, 3 Apr 2018 16:34:14 +0800 (CST) Received: from archlinux.g08.fujitsu.local (10.167.226.31) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 3 Apr 2018 16:34:13 +0800 From: Su Yue To: CC: , Subject: [PATCH] btrfs-progs: let mkfs return nozero value on thin provision device Date: Tue, 3 Apr 2018 16:39:45 +0800 Message-ID: <20180403083945.13485-1-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.16.3 MIME-Version: 1.0 X-Originating-IP: [10.167.226.31] X-yoursite-MailScanner-ID: 6514F48AE77D.ABC09 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suy.fnst@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP when mkfs.btrfs on a thin provision device which has very small backing size and big virtual size, all code works well in mkfs.btrfs until close_ctree() is called. close_ctree() fails to sync device due to small backing size while closing devices. However, mkfs returns 0 in such situation which causes failure of xfstests generic/405. So, let mkfs returns nonzero value if previous steps succeeded but close_ctree() failed. Then xfstests generic/405 passes now. Signed-off-by: Su Yue Reviewed-by: Qu Wenruo --- mkfs/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mkfs/main.c b/mkfs/main.c index 5a717f701cd5..9f7f2396df8f 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1285,6 +1285,12 @@ out: } } + if (!ret && close_ret) { + ret = close_ret; + error("failed to close ctree, the filesystem may be inconsistent: %d", + ret); + } + btrfs_close_all_devices(); free(label);