Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3565585ioa; Tue, 26 Apr 2022 06:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK3C7j0VQotiaeyh1vu8lxz4p6BcrZP1qwJlYaN+N65/4coQ7wnDZGtsCag1ehZQ/8s+2D X-Received: by 2002:aa7:c9ce:0:b0:425:c396:dde with SMTP id i14-20020aa7c9ce000000b00425c3960ddemr21299232edt.397.1650978746361; Tue, 26 Apr 2022 06:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650978746; cv=none; d=google.com; s=arc-20160816; b=s4MehOPGzjaiU35y6cECMYg4SEnPWQLOhbdWFfVPrlICjWIr5P9GTuo5raXgy0oCaN rPhO3IP5Bpa6MPjNdZauwrJQ83dZrfDcneq+t2W+0mOZZwoMLhbsN6+9y7zbfqyEV2bp OcCX3QzxnbnlfC87Q0zlEI9Cvl0n+N+qfIwriw6vdWdBHUPcfmCdmEraddVtTguSRG1W C61PaaRK4FjGysGuWcMd4t25S13iyAIoSAn5j1PKPenA4pnlHnZKIlTCygEDX/VA3c+5 RLXRmbHpPu28Uj2N+cFgxW/93idxk1YgCHn7B8mN+Uhe0p9Uv9H8yAhcE3sqlm2V80Pj GGGw== 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=b0IJVtXSOZbZBPA+2NnyPsNs/2OTcGLrsXAFiRy4P40=; b=K1ZiaATTLtkVDmYiSdBMjXlvyWwPS/QOvfAVd6otK+8HVILJvHlYz0U4nnHYlKY6f8 LAG1DgwzkbHu9keRWtD4PgkQeZo9+nldvX2Qzlahyn7A0t348uML0HnnD2jrbpJ9YDsw lAMXjoABML78tgbqqT9DgH3syFtG3lgPDnowQa795iCuLnCTJ/yedMmFsd933PtyIyyx 5W5hOkcH/w9rIYIjTbPIXPm5wJVAZt6s9TobLHLUmxTwjSgIp/C6QynKJnXsKtKdJJPl IP6Aa+5vVfac8fgaCSh8wOApB48If3Aa3wdRMNA16vde4/Z0/gIbsd8+nYVsqnjtrCWG TzEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Hto/VQKu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170906528a00b006f38feda92asi5899159ejm.277.2022.04.26.06.12.01; Tue, 26 Apr 2022 06:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Hto/VQKu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233061AbiDZJVL (ORCPT + 99 others); Tue, 26 Apr 2022 05:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345841AbiDZI5B (ORCPT ); Tue, 26 Apr 2022 04:57:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E7382D1D; Tue, 26 Apr 2022 01:41:33 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 719E3604F5; Tue, 26 Apr 2022 08:41:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 793C6C385A0; Tue, 26 Apr 2022 08:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962492; bh=mt4oTxRDRytd2sDxSUA4c6vTrTy49Qqxkea0a5v82a8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hto/VQKuTT6FLoJsqjiGUipyRgz/EM2bm64XjNYyGVzdvccCjywhL4hv5405R5wrz cs9gJesRLGhsMigN0w9pF+AGgS3JZVyfFhD1aSy+2e+Dc7ExCm7HkrGTfZztemwKE7 EQ/xfnz2DCT/dba0KeO6mpdi4N19Oa62bwdE7dwA= 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 5.15 114/124] ext4: fix symlink file size not match to file content Date: Tue, 26 Apr 2022 10:21:55 +0200 Message-Id: <20220426081750.532641271@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-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 @@ -134,8 +134,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); spin_unlock_irqrestore(&head->b_uptodate_lock, flags); if (!under_io) {