Message ID | 20250423085257.122685-6-yi.zhang@huaweicloud.com |
---|---|
State | Awaiting Upstream |
Headers | show
Return-Path: <SRS0=8WM0=XJ=vger.kernel.org=linux-ext4+bounces-7426-patchwork-incoming=ozlabs.org@ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=8wm0=xj=vger.kernel.org=linux-ext4+bounces-7426-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ZjCpf0k8tz1yMy for <incoming@patchwork.ozlabs.org>; Wed, 23 Apr 2025 19:04:26 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4ZjCpz5CWSz4xN3 for <incoming@patchwork.ozlabs.org>; Wed, 23 Apr 2025 19:04:43 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4ZjCpz59LDz4xN6; Wed, 23 Apr 2025 19:04:43 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip=147.75.48.161 arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1745399083; cv=pass; b=Dotl0u4IvR5f/TAXGcIWHf8LG8HVIdRQ7bDay9buAeo4NzF2eicWMSMicjrhkGr5SsBUbi1FyYl/07a9VlD24WyHlM50WTbOk4V9c5lTCAXIrP3DCjsMzfPGKlbeUN0LIBKekZeUGuM5vFJM9QusjYB3U55hVZtNKwkBBX98RCtShm+cgJutDfZ31U+kbnLI2JMBGJG+8emrMoaD9qi+oVKWkETy7owyXX7dm8TtiSvPr4e+SjB/t3xFrgo4aiRXElNeP3ZFDvVARRJOaV4SKW7e+AVp5yhiyClIArLMc20PXpo/sEA/2yWGkyFzuQhNUpZP91m3F1SYyX9/1bTimg== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1745399083; c=relaxed/relaxed; bh=G45wS5+iaXu02TQdjlGx5ImqFC83nstr6hAy6ANS3l0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qMRud9fOfcOhL8aGeBMZLJ7y61S9dGpBS4vUlrLSuQw1KBonf1ZnyoQDWDjpm8/EbwflMQ7Y24ltChq1Zqx2O1IcN6bn6tJS7oeiBhRCyWxXmEy8G9aCtMHetA26XhIq82tAwvC5iJFGsCb7twNSzOXnA5PhGc5VGo7kBOvDFtplieuUjzzQcMr8vSEvi1Ref/dcfjEjKTQW7rPPPGq9TQBaZJKXEzuE5sifkh2yG/SoZeXLRH1+lf3yBaLJAlWNaOxAvAp4UhKhWjAfsijxYVxEyWM5NB0EOUVgwRmKlh+w9CFNcQxIw/WlKjgPzNaiO9b22Ude7aEfPDqw9lSnXw== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass smtp.mailfrom=vger.kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4ZjCpw5kxMz4xN3 for <patchwork-incoming@ozlabs.org>; Wed, 23 Apr 2025 19:04:40 +1000 (AEST) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 864107A5695 for <patchwork-incoming@ozlabs.org>; Wed, 23 Apr 2025 09:03:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 775E125F96E; Wed, 23 Apr 2025 09:03:34 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 EB7DD22F773; Wed, 23 Apr 2025 09:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745399014; cv=none; b=i+siRmEhvIKuRD2dAjdRopsDEZahwZH1ztPbrNoEWlrGD4vtrSRGyUUoP1hVRv7n2hbl26Q7vZ2c2G3umfqOXIr5Pa68S7b6w82cyFJZxqs8cfbUzwxJfsFAbYJrzv5vtk4maN6F2+pSIH9vxbD6ySkrgZcfkqaBaoZoLnvPtgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745399014; c=relaxed/simple; bh=FcZJDwChboXMI56Jg7v4MIg7rQOojrMI74gGFAOu9h4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CdrdveLFhE3aHY1qNL6Bkm8I3fZ1KnXjGSpOQkPe95ar1+ToBOjy2tllXbQRECewU5+ST67Vu/RvghAJkeMR5bYxEGSD6G1bnSqd43pZTkmms/zDlAJow1JvkHYR/1IcLZL3pP4UT2mrEFE1FaznvX2K+YC4a4xM5NXkJpMYJEw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4ZjCmy65LPz4f3jdR; Wed, 23 Apr 2025 17:02:58 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.252]) by mail.maildlp.com (Postfix) with ESMTP id C86611A018D; Wed, 23 Apr 2025 17:03:22 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.112.188]) by APP3 (Coremail) with SMTP id _Ch0CgAXacPQrAhoJkGrKA--.8976S9; Wed, 23 Apr 2025 17:03:22 +0800 (CST) From: Zhang Yi <yi.zhang@huaweicloud.com> To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, libaokun1@huawei.com, yukuai3@huawei.com, yangerkun@huawei.com Subject: [PATCH 5/9] ext4: prevent stale extent cache entries caused by concurrent get es_cache Date: Wed, 23 Apr 2025 16:52:53 +0800 Message-ID: <20250423085257.122685-6-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20250423085257.122685-1-yi.zhang@huaweicloud.com> References: <20250423085257.122685-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: <linux-ext4.vger.kernel.org> List-Subscribe: <mailto:linux-ext4+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-ext4+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgAXacPQrAhoJkGrKA--.8976S9 X-Coremail-Antispam: 1UD129KBjvJXoW7tw4UWry7uF13XrW8GF1fCrg_yoW8tF1fpr ZIkF1DGw40q34DC392gF48Ww1UKay8Gw4UCFWfG3W7ZFW3J340gF1UtFyUAF1Fqay8Jaya vFWFkw1UJayDW37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkE bVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67 AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI 42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCw CI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnI WIevJa73UjIFyTuYvjfUo73vUUUUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID, DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org |
Series |
ext4: fix stale extent status entries and clairfy rules
|
expand
|
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3adf05fbdd59..b5eb89ef7ae2 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -5011,7 +5011,9 @@ int ext4_get_es_cache(struct inode *inode, struct fiemap_extent_info *fieinfo, } if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) { + inode_lock_shared(inode); error = ext4_ext_precache(inode); + inode_unlock_shared(inode); if (error) return error; fieinfo->fi_flags &= ~FIEMAP_FLAG_CACHE; diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index d17207386ead..0e240013c84d 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1505,8 +1505,14 @@ static long __ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return 0; } case EXT4_IOC_PRECACHE_EXTENTS: - return ext4_ext_precache(inode); + { + int ret; + inode_lock_shared(inode); + ret = ext4_ext_precache(inode); + inode_unlock_shared(inode); + return ret; + } case FS_IOC_SET_ENCRYPTION_POLICY: if (!ext4_has_feature_encrypt(sb)) return -EOPNOTSUPP;