From patchwork Thu Feb 23 09:01:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhanchengbin X-Patchwork-Id: 1746679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=bqqv=6t=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PMmcl1hTZz245y for ; Thu, 23 Feb 2023 19:37:59 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4PMmch35bmz4x7j for ; Thu, 23 Feb 2023 19:37:56 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4PMmch32wFz4x7s; Thu, 23 Feb 2023 19:37:56 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4PMmcd730dz4x7j for ; Thu, 23 Feb 2023 19:37:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233255AbjBWIhx (ORCPT ); Thu, 23 Feb 2023 03:37:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232056AbjBWIhv (ORCPT ); Thu, 23 Feb 2023 03:37:51 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9930A10CE for ; Thu, 23 Feb 2023 00:37:49 -0800 (PST) Received: from dggpeml500016.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PMmbt5YtSzrSF8; Thu, 23 Feb 2023 16:37:14 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500016.china.huawei.com (7.185.36.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Thu, 23 Feb 2023 16:37:43 +0800 From: zhanchengbin To: CC: , , , zhanchengbin Subject: [PATCH v2] lib/ext2fs: add some msg for io error Date: Thu, 23 Feb 2023 17:01:11 +0800 Message-ID: <20230223090111.680573-1-zhanchengbin1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500016.china.huawei.com (7.185.36.70) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add msgs to show whether there is eio in fsck process, when write and fsync methods fail. Signed-off-by: zhanchengbin --- v2->v1: - Delete return 0. lib/ext2fs/unix_io.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index 3171c736..a6c85874 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -1265,12 +1265,16 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, return errno; actual = write(data->dev, buf, size); + if (actual < 0) - return errno; + retval = errno; if (actual != size) - return EXT2_ET_SHORT_WRITE; + retval = EXT2_ET_SHORT_WRITE; - return 0; + if (retval) + fprintf(stderr, "%s unix_write_byte error, error %d\n", + channel->name, errno); + return retval; } /* @@ -1289,8 +1293,11 @@ static errcode_t unix_flush(io_channel channel) retval = flush_cached_blocks(channel, data, 0); #endif #ifdef HAVE_FSYNC - if (!retval && fsync(data->dev) != 0) + if (!retval && fsync(data->dev) != 0) { + fprintf(stderr, "%s flush error, error %d\n", + channel->name, errno); return errno; + } #endif return retval; }