From patchwork Wed Apr 14 13:47:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 12202811 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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 6EBE4C433B4 for ; Wed, 14 Apr 2021 13:39:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D0A6611AD for ; Wed, 14 Apr 2021 13:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346950AbhDNNj4 (ORCPT ); Wed, 14 Apr 2021 09:39:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16998 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346607AbhDNNjz (ORCPT ); Wed, 14 Apr 2021 09:39:55 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FL3RC0bqmzPptn; Wed, 14 Apr 2021 21:36:39 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Wed, 14 Apr 2021 21:39:26 +0800 From: Zhang Yi To: CC: , , , , , Subject: [RFC PATCH v2 0/7] ext4, jbd2: fix 3 issues about bdev_try_to_free_page() Date: Wed, 14 Apr 2021 21:47:30 +0800 Message-ID: <20210414134737.2366971-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Patch 1-2: fix a potential filesystem inconsistency problem. Patch 3-7: fix two use after free problem. Changes since v1: - Do not use j_checkpoint_mutex to fix the filesystem inconsistency problem, introduce a new mark instead. - Fix superblock use-after-free issue in blkdev_releasepage(). - Avoid race between bdev_try_to_free_page() and ext4_put_super(). Zhang Yi (7): jbd2: remove the out label in __jbd2_journal_remove_checkpoint() jbd2: ensure abort the journal if detect IO error when writing original buffer back jbd2: don't abort the journal when freeing buffers jbd2: do not free buffers in jbd2_journal_try_to_free_buffers() ext4: use RCU to protect accessing superblock in blkdev_releasepage() fs: introduce a usage count into the superblock ext4: fix race between blkdev_releasepage() and ext4_put_super() fs/block_dev.c | 13 ++++++---- fs/ext4/inode.c | 6 +++-- fs/ext4/super.c | 32 +++++++++++++++++++++---- fs/jbd2/checkpoint.c | 56 ++++++++++++++++++++++++------------------- fs/jbd2/journal.c | 9 +++++++ fs/jbd2/transaction.c | 32 ++++++------------------- include/linux/fs.h | 29 ++++++++++++++++++++++ include/linux/jbd2.h | 7 ++++++ 8 files changed, 123 insertions(+), 61 deletions(-)