Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4453523ioa; Wed, 27 Apr 2022 04:19:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW3vtpJB+9Il+4JRz9WiW3kNgeRaS8SNCzP7D1U+gUlk9leSzayR0W+5NAo3QyLX253s53 X-Received: by 2002:a62:6d47:0:b0:4fe:15fa:301d with SMTP id i68-20020a626d47000000b004fe15fa301dmr29457820pfc.29.1651058399074; Wed, 27 Apr 2022 04:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651058399; cv=none; d=google.com; s=arc-20160816; b=YHWKqbgDibmWws319rg+LsTTlI7tFWGq7yShLqyu0lQeMSKc+FayN5JOykMxElv0F1 KysBExKKf5hVwFcJJx0w+yhzUa+xDuqDtyHCFRMRJWIdDnzhJAsyaEdvqvJ66eLktlcE FpQ42R4kVeIFeNrRrgpUELhWYpkOw2NPE9yH50WBzm3NOYEQ3PBtrJ4i1IAxxPWdUOoW hMRHB5c0D8VVH9xf1tCF07ZIaHksha/VEUcCE6rW0USFrEBKFHVlxNxAGapgg3U3Nd4r dW1yC9tbTYsNfcslQj7tdOUkffp9lSWCX92D/MB8O26xmzqxri852vh6P2LLnI6DqOIH 2wXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nF3cRa3vKK7/kis+h6QPoEOECrsb2o0m7GgyNXXXXqw=; b=cp/58c0r9FsjqpJkuXxKZUeKEz5hJ8RGbOhdPqsuh1IJmRvVWvT84MvLkxh/JMslK7 DlFr8MuGCmOfYNyl8ZXiwWmwQSMac7oTmgwGtfuOW/YmSouLhZ6hsuJXW3VgneAwgxYe lP9gq7ImayYghdrRIinl/rZ/9WUj/HE43DX+7r6wM1PQLy3Q0KxMtuLMmQORAJd9b1Ei yjyOon4DNTUafIvuosKbkaBNtjyIjITcOQKfcZcbi4SlrX1VDgH1mtEj6dlOoDriU0LL bO/gxpMDWRCr1EZw1rMS6KCfG8VTzp8mc1njj5xGucmYZme7sl+Zea4Eo7olNiDlLEvr YpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IyzQG7MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w17-20020a634911000000b003aaffcb93e8si1366019pga.286.2022.04.27.04.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:19:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IyzQG7MD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B81D346D445; Wed, 27 Apr 2022 03:14:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345263AbiDZIiZ (ORCPT + 99 others); Tue, 26 Apr 2022 04:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345517AbiDZIel (ORCPT ); Tue, 26 Apr 2022 04:34:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32EF578928; Tue, 26 Apr 2022 01:27:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C587EB81A2F; Tue, 26 Apr 2022 08:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3394BC385A0; Tue, 26 Apr 2022 08:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961651; bh=Wgd36B5rjC5/ZHNoZuT+EVys1kOLNjl1nZr2tmHVyXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IyzQG7MDEsrk00dbVINB6OWteuS2qv0XG8cFthcLoJi7NK7NcKYXiwV1VPVqAp5u7 tciKl/6QpYxTRW4e3WsP4FdJf7kCGT9/7ekdJ3I/a0mhpemZRzB4ZsYw9nhGfvfBrN j9HwIp8Uk070iUSqKP8EKfOfUUs81pWIN4gge72s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 4.19 39/53] ext4: fix symlink file size not match to file content Date: Tue, 26 Apr 2022 10:21:19 +0200 Message-Id: <20220426081736.794937216@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081735.651926456@linuxfoundation.org> References: <20220426081735.651926456@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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-kernel@vger.kernel.org From: Ye Bin commit a2b0b205d125f27cddfb4f7280e39affdaf46686 upstream. We got issue as follows: [home]# fsck.ext4 -fn ram0yb e2fsck 1.45.6 (20-Mar-2020) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Symlink /p3/d14/d1a/l3d (inode #3494) is invalid. Clear? no Entry 'l3d' in /p3/d14/d1a (3383) has an incorrect filetype (was 7, should be 0). Fix? no As the symlink file size does not match the file content. If the writeback of the symlink data block failed, ext4_finish_bio() handles the end of IO. However this function fails to mark the buffer with BH_write_io_error and so when unmount does journal checkpoint it cannot detect the writeback error and will cleanup the journal. Thus we've lost the correct data in the journal area. To solve this issue, mark the buffer as BH_write_io_error in ext4_finish_bio(). Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220321144438.201685-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/page-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -105,8 +105,10 @@ static void ext4_finish_bio(struct bio * continue; } clear_buffer_async_write(bh); - if (bio->bi_status) + if (bio->bi_status) { + set_buffer_write_io_error(bh); buffer_io_error(bh); + } } while ((bh = bh->b_this_page) != head); bit_spin_unlock(BH_Uptodate_Lock, &head->b_state); local_irq_restore(flags);