Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp44924pxb; Wed, 14 Apr 2021 09:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/7otI8vZhJeZV1OpPTaXFLV8M3l8jcG6PJ6uNE3HqnfmE3VFXFiDEQCM/X5oEDwSITAj8 X-Received: by 2002:a17:906:2755:: with SMTP id a21mr22838620ejd.278.1618416251043; Wed, 14 Apr 2021 09:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618416251; cv=none; d=google.com; s=arc-20160816; b=bN+Ya6INdn4GxSs30eAebbl4Ooo9tmhqmz6ZbsadFGSQzy1SdAsU5Cy/zWv+dJgSJg oN+cNsAfOM3WASNv3eP5oA1lORQDST9VFv2/hjuCSiMlXw8zOqO8tv5j/4mt3nY+j00d QFoZWXgbLDDEjxVOhRMFww1OQXwhwe3D5u0170FYADkvPHkIaezA6RmjQU3XA2WPRHgl YJre+obnsgwxmUCpk7kU0Ea5YhoUAmQEelrp3+sh+C1SGwhSpZSqncPQW61vtSZYLAGv 6mWNfi8O55JKhlXn8dsUPshW751Rn51k44MT8AWA14gCYLhCcQdnEgGEKt7FPy0PBD3f 3Y7w== 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 :message-id:date:subject:cc:to:from; bh=CvUfmcFXod9S0OOy+szSEQ4DItZ3Abx+3UyIRNpizw8=; b=r+qIBZSlp92N7nI76NyTmnHFDl15I/DzZfITPQwrpkx5PH/W2vhAsUWTUyzQxnPLaH 35+hsBQjE3ArJfraup+Px6TCCu0eomnrhxZ+MSMpPGjpA+BINIxyHA9623LD9NoND4WA 4RF/3MRU4QMfLlrfqKhSYNLg0j1o4lqw6pNLwVrs9ln8U96LjXOOkz4UFykiEABtH/m9 80RdjNmOrZIZVO4CfnmOy2+gw/xG/TBF56ac3Eva42ccma87dgkvke8WXUq3NVZ1/fMf /PnDPdMYgNVxHbeuoA3SMkA5PDWfS9YV9PnJvw469mry1xZp1/dIj+MQ1eHDccZzaYap jyHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si13120397edr.458.2021.04.14.09.03.16; Wed, 14 Apr 2021 09:04:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233735AbhDNNj4 (ORCPT + 99 others); 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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(-) -- 2.25.4