From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3D90B3E92BD for ; Mon, 24 Aug 2026 07:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787555611; cv=none; b=lKzIy497cZDZE9823NMws4zSLYdJaOwOpULCYE9No7qxKhhhadBY4PjFmT1BeHLCO9rgGcKljf/JElDHLhvUwTK9AU1hpq8f0YJLm+hMI3B7CHE/9Pno4OCRtIARmEiztT1nxlIslBdshzA8Omk2GVNTr4oBtReAaIUd2v2fCK8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787555611; c=relaxed/simple; bh=VLTtfyJEclTfkYbHp7rooa1VyXSfJjklhbq7eomBwHw=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=CdT2Uks+eoMdWfuNpoQ6PSKk8Q/lbBkWJjoUrRxs9gNn7RU4u0uaMEpxje9in7+bhY4RfTUK/PfeNwEx12GsgyD+MebQB6zIXHtXRznOC5mBdfxvU6tF6BcYlqUWbROTz4A9GAd2hZknu8CiyovFcBeQ6ic8MyeOVtNuWxlKi4I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GP996H5N; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GP996H5N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D0411F000E9; Mon, 24 Aug 2026 07:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787555609; bh=XvsXeq4eUYOgZOsgjFbHfYmUL2up8it0tx4AeAyPmRQ=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=GP996H5NI6ogxnm/GfZADApU/aqtgYbU68+oLd1bylY4O5WnzWAVXXnacwo7S1I9U 9J00opDVImT6MFQhG2A/nvZ3cVv412UGlOnln2OVevzXmI5xABLTExNaFkj6flQAy9 YNRyZkF8LJIbu2OHjKOnLF6Xe0a5H9uz/n9oYjGHRHps64oJa8Xr5OHo5Vu1nfmQ00 bTBtHDJgyEvjBZMCfOY6j9nMoctaWiU8Q9aEt9rNSD5opEykFxbperKO3AvoBjBIUO qQv0a2qG91nCwxxzleovkstckGZ6OJEztbVvaKOVzNwC9H4RlerjWvRX/XZGCZX17s SMfDrlolqRd3g== Message-ID: <234a5bd3-76d1-4fea-bdc4-f1dff01e591b@kernel.org> Date: Mon, 24 Aug 2026 15:13:26 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, Wenjie Qi , Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH v1 07/12] f2fs: cache: use node cache To: Wenjie Qi References: <20260820031721.12218-1-chao@kernel.org> <20260820031721.12218-8-chao@kernel.org> <20260823125735.3230503-1-qiwenjie@xiaomi.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260823125735.3230503-1-qiwenjie@xiaomi.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/23/26 20:57, Wenjie Qi wrote: > Hi Chao, > >> entry = 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 the > entry and set `entry->cache` to NULL. `f2fs_cache_wait_writeback()` checks > and uses `entry->cache` through separate accesses. > > Does the reference taken here also guarantee that the parent cache remains > 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 = NULL - f2fs_cache_wait_writeback_cond accesses invalid entry->cache Thanks,