From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75D1C361DCB for ; Mon, 24 Aug 2026 08:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.167.48 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787561847; cv=pass; b=Tnz395TvBuMwj3qFlMljCWeq08GHocrBwccWDzJ/1MYRpkBHCBglhpb7+k0Ay7yGYEuEKCJXsfyqqaevAu75I5u82UVVikkfPjfO1EPI/oKNkiCKb1MifWN/nVW48TFue1hcB3+MVZ9y8iTLNOljM6adxJgVp2SUaySww9as7mw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787561847; c=relaxed/simple; bh=eh5hkzcFZWqfxpKZA8O5Qebo/jKwWS3/fnbiqyH37Fc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=azz1Rc/WmrMbVNu6z4RtrBYeLQKgt77DPAkOmfkf0ctDsOkqHLKBA2Z1v/90xwCGk2a+d2nv0odsdNk8piHF1jJcJ9F/g+T/pGxyOJbOpjoxS4usEXQnn4jiUgFeIB35g7DXELbbR1oAixVgmQ9ssTdGDh+Ml20tLiXqr+vPXC8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UcUpnXzV; arc=pass smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UcUpnXzV" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5aeba09900bso2504676e87.2 for ; Mon, 24 Aug 2026 01:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1787561844; cv=none; d=google.com; s=arc-20260327; b=g/bvRRJ2LIdZwdAu/oyaaliPK1PYPQjjuLJB7hT5jPxlYPnjj0Dl5yuxvKwZZEAaOu rMXzuCkyUU17Y0Vh6xrKX1JsenlJXfTViR8PEAMMMDZxZw61X5m8W9xn6kP0GoEZapax bZ8wypZJUiZEimLxbH4Aa9iAY69tj/g6YTDr9ikXTI8rsxYxmWTwSkodFRi8nAPpPKzH j6cexLJaGsYdLgnp6g34u61vVa9KLTsitDRl61oLt4WCm3TtKayBibkeFbYxBV8hhs2R mZSloHtPJzi9eGMp9B6cHvvtnrk3RyQXj9d2EYKVaSqwnou1KgV743GLWEAHAiVHzpYI pKgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2uRvUUWtl1lJZbmuXqBD0966eF9meh+dTRlx2zjrvB4=; fh=n9DD6dQ/eHwheBM0CvPBsfOHDLKEH+HP/t6Ay/KeVMU=; b=In4Fu+m8GbA/9OaV/EZ0yCwIXvipoxYJYsapbSe6LUx1l7p8roWuaWRPqZWffe68FP i2IO/XK+cXuReSBOJo/IHGoYUrJmYYSRI6OhdQGjfpsJdipWMFdj/qVelYgMBL+YYL6T 7p/SWP4HwLMj6BPelMWca51D+IHAdWYkKAB15ySPmSmo7jvL1vMJT4K8vUP3NAv57tMi Rlix7GCrbndQkOw8K6gbviNbCUMljpoZo2pQUNcaKVdbvmC/sX1M42rh9fE83ysswwnM VUqdIW+TUm23wH1N55ZFdouS7NkXu0wTnVYqet9Pq07tP4uRU7ksX/PukadXH/71t146 eUHA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787561844; x=1788166644; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=2uRvUUWtl1lJZbmuXqBD0966eF9meh+dTRlx2zjrvB4=; b=UcUpnXzVplPxyMbMtVmXjT9eo1bT65XDe6unFMxP/fZlJbDClEOJJg+VEu42xb1MyA VqeOjpnNLptDyrUXe27dpHWI0RuKCHpr6Ilr1iQ80hStzG4IZe1aw1pg9+m6AdqN4QeZ lNm6qcI4WIMf5MxLgeJI/0rxSViTUonltp3l3mG5xxHUqjgxLsIM2+jKUWPRDNtNFGEM qZc61iPZDdpQtpWyQu4HlWZI2mkgb6aWNNEAzjsP9XWXik/TxETAV4LJOmvi9A3cBRpY ZCQYgcmvQNjeDg7gU3pD98yM66HI/qa+AFxHCnxbwXWCYkJn1QY6CmYT3A2pDvwTAcYr PZPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787561844; x=1788166644; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2uRvUUWtl1lJZbmuXqBD0966eF9meh+dTRlx2zjrvB4=; b=RLgHh5CuxGGhYCMATwRQo5Whzs9zJh3ZYjd63x1/FqcNwr62bbnPY7chN1QSulReJk pkNyotXC/+HEobaF5VdzqleEwtF+/p2k/IPX1Fn1HSwLAr4fcIxEpt4S3vKnk3hZzu3j EqOogwF8GI5DDQlupA1Hss5bwRUTKZL4HOzG5fv3dIRDrrCUvgW1Yv/DqrtUPQgNLQt0 /VKqY7d3VdwJYb81IqwUb4zXHghuexecxUMQQ7ipbyLhPn7FFKtmzVT20+ifftlOPEfO cat51uczU5TCLn06I1eRFKrkn0Hh+kvYlKbG8ZPNhgBJJU9XS4v4XX9zR7ak7fS4mdWk UeXQ== X-Forwarded-Encrypted: i=1; AHgh+RoCiCWj1UnmFnQBO4RXoDZi/NMlRyC3O+sA8yH0X1rW8ZPnZkx8gtGjv0FNTrU0MUz0PAK8ggz/WQ/m6/A=@vger.kernel.org X-Gm-Message-State: AFuF++lu3aVYlThmWfXOKbHlaFtu3H/NEdbVbF/pvIy5/RK0VLTQKmLG gsT0ndmMTfDIn4wpJ297wR3SqQpaXr/tNa1na6glyJ20R1bRToUTfz4nCYhQdEzdQRG8HD9NRSH Km8PgOLpFOQ0KrL5iMuj7gwUCG3f9h8k= X-Gm-Gg: AR+sD13CjsTjykL3XqlWisCfppuVX3doB8QxpbbAz2aEH6eA7RYwoDZsltRkz0JVkyY GhyAgU8mqpsAjO65LGURu7C6p7VmCZCwGt4OPybFkngXPBbIn3SzYpI+xgV5cwHWgMpgK7nUXgT /+DAMemmJkXEf8SXG951YEDuVYUEJZSd9gGNxp3dcLXlo5HnS8wg/COEbkLHe6aOm6i9HiusolB M+ot0XLmIOiNBhYFcIs1sJVfi0Xx10Q/1DXwSzk1DTe+VPWIOXzj6kOER+s+frmLzOGos44RYzx msqflQUoR2rBgapOM/d/LEsLOKb3/MNygOHRp6GVIcesZwWMOpB9d7vi X-Received: by 2002:a05:6512:3b90:b0:5ae:c8da:6254 with SMTP id 2adb3069b0e04-5b484230f39mr7242212e87.22.1787561844161; Mon, 24 Aug 2026 01:57:24 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260820031721.12218-1-chao@kernel.org> <20260820031721.12218-8-chao@kernel.org> <20260823125735.3230503-1-qiwenjie@xiaomi.com> <234a5bd3-76d1-4fea-bdc4-f1dff01e591b@kernel.org> In-Reply-To: <234a5bd3-76d1-4fea-bdc4-f1dff01e591b@kernel.org> From: Wenjie Qi Date: Mon, 24 Aug 2026 16:57:12 +0800 X-Gm-Features: AcwNN1WS7Rq_hHW9WpD2fNhIq4IlRc3NGb8k1DhUthJG37b3E1cB7_WXYClP73o Message-ID: Subject: Re: [PATCH v1 07/12] f2fs: cache: use node cache To: Chao Yu Cc: Wenjie Qi , Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes, that is the race I meant. On Mon, Aug 24, 2026 at 3:13=E2=80=AFPM Chao Yu wrote: > > On 8/23/26 20:57, Wenjie Qi wrote: > > Hi Chao, > > > >> entry =3D fn->entry; > >> f2fs_cache_get(entry); > >> spin_unlock_irqrestore(&sbi->fsync_node_lock, flags); > >> > >> f2fs_cache_wait_writeback(entry); > > > > The entry reference keeps the entry allocated, but the waiter does not = hold > > the entry lock. After WRITEBACK is cleared, invalidation can detach th= e > > entry and set `entry->cache` to NULL. `f2fs_cache_wait_writeback()` ch= ecks > > and uses `entry->cache` through separate accesses. > > > > Does the reference taken here also guarantee that the parent cache rema= ins > > attached across the wait helper's check and use? > > Do you mean race like this? > > - f2fs_wait_on_node_caches_writeback > - f2fs_cache_get > - f2fs_cache_wait_writeback > - checked entry->cache, it's valid > - f2fs_truncate_cache > - f2fs_do_truncate_cache > - entry->cache =3D NULL > - f2fs_cache_wait_writeback_cond accesses > invalid entry->cache > > Thanks,