Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1150481rdb; Wed, 24 Jan 2024 06:27:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvIM2CLpynYiwccmLkLYJ47SMpihDIDXj5m4kElFqnz1F7AwDU8ER/I3U2/chEBK/sauCz X-Received: by 2002:a17:906:8317:b0:a2e:bf57:3613 with SMTP id j23-20020a170906831700b00a2ebf573613mr679854ejx.10.1706106431548; Wed, 24 Jan 2024 06:27:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706106431; cv=pass; d=google.com; s=arc-20160816; b=SQ60O2FA2rMMFyBThfxkQ0P5rnsyTQ20D0w4WNSPX89eAJ/dcBmzVe/gs5i6hmvFU6 o7y/JL+wECX0+EHaVr/5EJl15BvfRCC1IITCht56jDgqscv43B3MjoctFJAcM41BgRSx h72ElFW2c1fmB5a4K+s2/JYcl8VrAgUscgWvrzehjEYlC2BCYiMKq6RWeTdRWrTFfkKl a+EbbRno5XPEE+pgxl5OdSlzCqjIFBJqvDTgDckReiJyrMsQ7Y7fdV7ywj7+PIiC82kC 0U1aN0A2QqOfCgZuS3yw0XhOsSzMJ2dhKDvVGaYK9APjPtuUiPiGrXOXAUQ7toQsjhO3 dcXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KReOQYVu+gBuMJ7XiJQDcvdHytQ4+sWrbQnvsZFp98E=; fh=dDY4I4Bcgn+6dTfxbc/MYfE9iPFYaG0wF2rciO7UdKE=; b=uF3E9anieZihWvQiHlWMtiOrmy0uDFXhLg4Qm0V6762l57EsVZRqtjsbuve/c3gkHx 1CcVDglELUDrXRF1yzcKqk14gzwU+H+cir0wEeN/DDOdbMR+pdhYfgpuRaB0Ke/BisKO ah/yEu32wJG0Om7MVJji5Dx75RiMdHMW1iCQG8n/MciIu81ZGBC8Eph6efjE/544EV0I o7FMk969YWFdI5gWIGypCWjjRzJod8WmfWdf9Dcxy7gCo/5octKBXiKFzKXky0GVhPbT uALkiyBJJ0V4bc75K3uEiVBKH1cVLOWzQB7Y6vxhY1W9Ev6Ji49mcPuNTL+DweYaq8mb i/OQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-37111-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n16-20020a170906689000b00a30a8927889si2191881ejr.227.2024.01.24.06.27.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37111-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-37111-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4CB901F2CE38 for ; Wed, 24 Jan 2024 14:27:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D5117CF03; Wed, 24 Jan 2024 14:26:32 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A7AF7A718; Wed, 24 Jan 2024 14:26:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706106391; cv=none; b=l/cyCXUPz7YEkH6o6AVeJgA989Df0zQptuot2hIe4wi/sT0SNmPkpxU78Va9/0AKlLYibYeUbu9FU4eFzjeIgsGp03gK1wwgRGRDX+hIj50d3bWvhD0s/LoFGJpQD5THPbizEC4L4wyUZLuds/IlGT9MnQXvF6FTXmMCunSLfm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706106391; c=relaxed/simple; bh=N2BkwODbR5p4I61Zd4giHOOLJ0sc4FCaSVpwgMLT51U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PgJDpt3RL/RwtgO4t9ONXgJ2i2U7LrBa3raBv+lQgq7/nPkS4uwV+unKvP1f5FxmRrkqpRLzJok0AkVbMqdRmK30PRaCJAbYwn59MPh7z9CUFJRaqEHBfHrZXRTp7WEo+4fzHTpdxA0evWPXMFgEqu0bjx48iSzTYQscIiuX+Mk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TKmS9199Cz1gy0X; Wed, 24 Jan 2024 22:24:41 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id 6403114011F; Wed, 24 Jan 2024 22:26:25 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Jan 2024 22:26:24 +0800 From: Baokun Li To: CC: , , , , , , , , , , , , Subject: [PATCH v2 2/3] Revert "mm/filemap: avoid buffered read/write race to read inconsistent data" Date: Wed, 24 Jan 2024 22:28:56 +0800 Message-ID: <20240124142857.4146716-3-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240124142857.4146716-1-libaokun1@huawei.com> References: <20240124142857.4146716-1-libaokun1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500021.china.huawei.com (7.185.36.21) This reverts commit e2c27b803bb6 ("mm/filemap: avoid buffered read/write race to read inconsistent data"). After making the i_size_read/write helpers be smp_load_acquire/store_release(), it is already guaranteed that changes to page contents are visible before we see increased inode size, so the extra smp_rmb() in filemap_read() can be removed. Signed-off-by: Baokun Li --- mm/filemap.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 142864338ca4..bed844b07e87 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2608,15 +2608,6 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter, goto put_folios; end_offset = min_t(loff_t, isize, iocb->ki_pos + iter->count); - /* - * Pairs with a barrier in - * block_write_end()->mark_buffer_dirty() or other page - * dirtying routines like iomap_write_end() to ensure - * changes to page contents are visible before we see - * increased inode size. - */ - smp_rmb(); - /* * Once we start copying data, we don't want to be touching any * cachelines that might be contended: -- 2.31.1