Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4847FC282CC for ; Mon, 11 Feb 2019 04:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E413D20855 for ; Mon, 11 Feb 2019 04:31:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mit.edu header.i=@mit.edu header.b="YRZ/U1hN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726883AbfBKEbg (ORCPT ); Sun, 10 Feb 2019 23:31:36 -0500 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:63776 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726253AbfBKEbf (ORCPT ); Sun, 10 Feb 2019 23:31:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jvDLjPm/tUMg23toZVohfVyJVvhoqROg1HIK3F1EdH0=; b=YRZ/U1hN8+0ANw4cLLhlYCkK1/C7bbVTzqwb7edtdKCuQ/cTb2pR/h3XPofQ1Q5f9+gEIRWr00u0FIazsVUn09J3MLix9x1oZXiThhXfOKLH4CkUDsI0TzIrIqrTNKUUBVxR94GdcAqiKXHP17746j6rpDTov0mKQpdJ619gluc= Received: from DM5PR0102CA0021.prod.exchangelabs.com (52.132.136.34) by DM6PR01MB3755.prod.exchangelabs.com (20.176.65.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.17; Mon, 11 Feb 2019 04:31:31 +0000 Received: from DM3NAM03FT021.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by DM5PR0102CA0021.outlook.office365.com (2603:10b6:4:9c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19 via Frontend Transport; Mon, 11 Feb 2019 04:31:31 +0000 Authentication-Results: spf=pass (sender IP is 18.9.28.11) smtp.mailfrom=mit.edu; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=mit.edu; Received-SPF: Pass (protection.outlook.com: domain of mit.edu designates 18.9.28.11 as permitted sender) receiver=protection.outlook.com; client-ip=18.9.28.11; helo=outgoing.mit.edu; Received: from outgoing.mit.edu (18.9.28.11) by DM3NAM03FT021.mail.protection.outlook.com (10.152.82.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.10 via Frontend Transport; Mon, 11 Feb 2019 04:31:31 +0000 Received: from callcc.thunk.org ([66.31.38.53]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x1B4VT0a023067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Feb 2019 23:31:30 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id E95347A4EA6; Sun, 10 Feb 2019 23:31:28 -0500 (EST) Date: Sun, 10 Feb 2019 23:31:28 -0500 From: "Theodore Y. Ts'o" To: "zhangyi (F)" CC: , , , Subject: Re: [PATCH v4 2/4] jbd2: discard dirty data when forgetting an un-journalled buffer Message-ID: <20190211043128.GF23000@mit.edu> References: <1548830980-29482-1-git-send-email-yi.zhang@huawei.com> <1548830980-29482-3-git-send-email-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1548830980-29482-3-git-send-email-yi.zhang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:18.9.28.11;IPV:CAL;SCL:-1;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(39860400002)(136003)(396003)(376002)(346002)(2980300002)(189003)(199004)(8936002)(47776003)(6916009)(6266002)(6246003)(4326008)(246002)(8676002)(305945005)(33656002)(26826003)(478600001)(90966002)(23726003)(46406003)(1076003)(75432002)(229853002)(76176011)(50466002)(356004)(106002)(36756003)(88552002)(52956003)(2906002)(106466001)(26005)(36906005)(336012)(86362001)(186003)(486006)(786003)(446003)(2616005)(126002)(316002)(16586007)(476003)(11346002)(42186006)(58126008)(103686004)(54906003)(97756001)(18370500001)(14143004);DIR:OUT;SFP:1102;SCL:1;SRVR:DM6PR01MB3755;H:outgoing.mit.edu;FPR:;SPF:Pass;LANG:en;PTR:outgoing-auth-1.mit.edu;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM03FT021;1:Aq9ACWr1vo2Rl8mEIOSm39w12ZjO7b+gXEeo+/yPY7H05DLai0mv56x7fjqDAuQjhjZpX1Xd9yQYqaSBLFOra+qnwC6qo8eDdRHuPVMem2Sf+L7+gYKRd6ABN5KycmZuRoURtQvrMKdwhK3IIFYPNYCfN+YPqm3INrpP/NeaTBE= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c79946bc-d7b9-440b-96dc-08d68fd9cc27 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4608076)(4709027)(2017052603328)(7153060);SRVR:DM6PR01MB3755; X-Microsoft-Exchange-Diagnostics: 1;DM6PR01MB3755;3:9I/sOvJ0xpdDNKVGc1eG3HVvelbVZ21sUYAqFl7uETSGs7ga/vcFtv1fcG8nbte1g+RhT/hQrKULj4g2Z2iUzK72MPCyaCaidtMMPP+x6LH35gxbnBRgPzNdOZfNt/4L1g5RPhl/0+0cvTv5fpv8P/VaxZbQK1cK2umawjz/uIqtxT56UxhRKsBj0p6gJb2nBKNJdbmvMeHjimvBnaYfTA55iLI/EcgBJbouKzdXvCiHPBhnlRh7WxgmH3Br7RAtXjEyn2glAfoaPElKWejnny9uHtsIRAlBYOlfuKg0H8EMlE/6WQNQde8re6kxoyoXFBTbN59zWXW0z2wIJDaCBlL4KwWdaDc6ok/L9vgqVAEX+UeY9WWhAGiC11wiZqyU;25:ZwgJ/MxfxsnIsM9FVP8bWIv1p32ZbFDNMVX1DuveZX4Gqqy8FaX6JVK2VLNYjMupO6JQq4v3mTkidEur4bL3xO1I/y9S5gxqr85CQvoELKREUjqk+Z97fCaWCVDI1RHhRPAjy5Q8l7itG6PUhRbdOsKYaXyfN1Vl5aB/Mkkiua8d1dZuB/b2nzGcswsAGSlrLP512qO4w7Ebmmnx3Jw7W9TjNTQTPE6asYTYVcbVJegPsN8lSExw1+vYlIiepWFuaTPkeGkopVVDRq5nvdp4QGRNJdqWTfHdI4ygZEJYwbNGnvucLdemrFvhoXDzwn74o24YM7Xkw9r4A5evJ0CkKg== X-MS-TrafficTypeDiagnostic: DM6PR01MB3755: X-LD-Processed: 64afd9ba-0ecf-4acf-bc36-935f6235ba8b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1;DM6PR01MB3755;31:jRgbwBGxHl1iffK8jcT6Vn3R5BQhXjm0oGJ2gBps3saULlPsT/ej81tfvgbbUM/jg9Y+mQf6zdkvBLqQbDWh2Y3b1sTcUohVAChxskePKsNpc5MkgdSTgOrtvag4HGSHj8bF7C9hbIFZi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sloUspBzt019tbSBmH4TQPvps4NYnEMx9mguhULYRg2gEz+UtFsme3CJMIqdNI7pZRbGE1E9eZ62KttlTNwot4JLpUfsnJAa4SNHiUNb6/z+OeR7CO+XAcqAzOf3jMj0jrbJfaQ4OWUuS+ZCN5YGT/PFEn4o/at6S7v7EQNaIhPmIfE7R+JduBr+guYB0GbhnzBm10GsyRxUhLUWOfaj/Zf+Tdsa/rQDIIdEuu62SyiIyt0O+vWS3+WP+MPN2qbpOS+P3Iw3f4rHtpy1cMjijI65BXdkewSZPsMqL7qxASGYKGt9WRUsvkfIroQzhJxv56HEqKkT3Oy/2tjYmhXh8ihZQZ2G2jKnyt37xWM0krHyeDdcn8cAZuCZ5U+ionKlEqRyVpmrGQazeGFzqN4vquQcc1Np/uRh02QpDw96IIpWMGGr3RQ==;5:HnTfOchObYwk8LmWnZ4PCQ1dbLm2sDRCaNDNNTGEurMC7cstf4/7fj0eaEM3y9FufJQjOqRYpsvu223NJMMcEPtt97zKCFBrCiRfur1Wc8XGYR474+BMeyIwbPjqPaHaHClufz+EM9XDOwJCkX8ogk2csygMkokmv0cOfaDd7LT453lBW/lwq9R7LNJcebCBAcA7BDUWO0evmNZdIOxOqw==;7:MyyBMaE8K3ZKr4Bl2RnIP58sjJEBidzOQcWcQEb3atyS7UxnCQMBEXdfvOJT739gtYzbsu3OuyXoL/UUtUVFU2wrbzJWWaLUe1RBkYFMgudIOWPkltddyWfGdFH/TWRUdpKaebF8h3qxq4VaOrDUxQ== X-OriginatorOrg: mit.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2019 04:31:31.0483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c79946bc-d7b9-440b-96dc-08d68fd9cc27 X-MS-Exchange-CrossTenant-Id: 64afd9ba-0ecf-4acf-bc36-935f6235ba8b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=64afd9ba-0ecf-4acf-bc36-935f6235ba8b;Ip=[18.9.28.11];Helo=[outgoing.mit.edu] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB3755 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Jan 30, 2019 at 02:49:38PM +0800, zhangyi (F) wrote: > We do not unmap and clear dirty flag when forgetting a buffer without > journal or does not belongs to any transaction, so the invalid dirty > data may still be written to the disk later. It's fine if the > corresponding block is never used before the next mount, and it's also > fine that we invoke clean_bdev_aliases() related functions to unmap > the block device mapping when re-allocating such freed block as data > block. But this logic is somewhat fragile and risky that may lead to > data corruption if we forget to clean bdev aliases. So, It's better to > discard dirty data during forget time. > > We have been already handled all the cases of forgetting journalled > buffer, this patch deal with the remaining two cases. > > - buffer is not journalled yet, > - buffer is journalled but doesn't belongs to any transaction. > > We invoke __bforget() instead of __brelese() when forgetting an > un-journalled buffer in jbd2_journal_forget(). After this patch we can > remove all clean_bdev_aliases() related calls in ext4. > > Suggested-by: Jan Kara > Signed-off-by: zhangyi (F) > Reviewed-by: Jan Kara Thanks, applied. - Ted