From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 9B6BD3126B5 for ; Thu, 4 Sep 2025 15:12:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756998756; cv=none; b=BiRKmPUDbETd8GAU9wP7csS7qAp00JsFUVpKN+dMRL4QDyedQtf791uXhdaAcYo5mX8RBsnD4kuR8AXDDa0C2tSnFup9bbaJPgdPjbdPw1uHzwN5ZC1hYBG1V9qMwFMWvOuFuiCRV7whxnwU0RcAdIPkhq2zZ89aR3bnZCvyHA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756998756; c=relaxed/simple; bh=aIikodAWNvOPuawsDRH+xHUIshm6ytHMJPcjPbVbcAg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KSaO94qnFxnCKoaT/1t5hpichLDueCz//6myiO+1Nb6hEpCpYxICSv2zQQ7VzrVaoijIc2JrBt44mViXSB2Ow8wcV5bGCg3oKRSOrSHZRcxI6TIMdYnhGaEmNj0dkmkwJgoY9MRglqTkhYhmfzqGM2IrdluvuQNA+ju6oRTeuh8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=qPS6/+oU; arc=none smtp.client-ip=209.85.160.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="qPS6/+oU" Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-4b34a3a6f64so9669961cf.3 for ; Thu, 04 Sep 2025 08:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1756998753; x=1757603553; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=x2bseHOEBBpGAfAnc9SJg8Haxdiy2CnaUt+NMaQGK5o=; b=qPS6/+oUwtYxPhddKOTTWnn+0stngF+iEzMWAoFELKJeparcWb1DWaT+6x3cWG6cD+ wTrLHxFxQ8KU0ZTHsVR0GyCMYr6y+cgyjb4vOCgN8pB/YdGsrplDeE6NhsIqlZt9kGhA fwcxnsvyM219+ouGLAUP0AIReZ6wzYrIU/cuw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756998753; x=1757603553; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x2bseHOEBBpGAfAnc9SJg8Haxdiy2CnaUt+NMaQGK5o=; b=rqoG0wKp+A5ahTmOrqqM5SbmX4opO094ef2wARB2S2z9a86ZF8xvjCqHTv0j7ptOZU udANgDGY6dSxlQfZKR03Vo2bMY5RF9j9RcuX14SLMp4Qlxp+PzuDKj8rdQu/qTZv+gNj KCxSLDQboaD0iQGe8e7dlSKW47pfKCoS6TZNpsrXV05TGTuiGU6axkGrPhwdb0Qu/Q3B LP2zUIYBd3NT+K26lCaPSum5hAYDh5LMXIirHNaleOzupdENPveeJVG7Bn4pk3SycjEX lkPC2MRmM2oLXUVTEnb99/hKu6ZkMq61Pflgrv+JIIXJ+LxX4T3kkQ0w6r6Jp1ipGO2J teQQ== X-Forwarded-Encrypted: i=1; AJvYcCWQtWpCkaZuA8x11e57AoBbvPUt5Pl5mgjutm9fH/TgzOkybR2Oh/EFbhbmrqOokjCVJPGi8g0x0WTaVzs=@vger.kernel.org X-Gm-Message-State: AOJu0YxnekMCjwvv/jQJa0Ooa41WZ5vJgHUPvIbt0ewnzKPw9px9nSGV VKqZbD0uibYlE1R1zdBzFZA3k/cYQTHuDKXwLa3duY1NwRmwKHqnHe1HV7CXMIeQ2/wjd6Oaq6e Yf/gS+HTMO5JXyFjX9aX20cqgLv75Fs465nV/rLu38g== X-Gm-Gg: ASbGncvFZ6hCkk1/s6fWtMIWM9PeHqP9kta6UGJNZUDdsMaiLlS/vWo6kbCNparNHR7 kiCQvat8mGoFHbkJAiAoT3nGDs8SVjOJ+2ph/huLxJo69t6zGecmiLwooj26xMPjzD7PU7i0VxN 2PcFHpe7M+j65Af/eU88Efw7xLgx2hEeqNJupZRebjmJFEKk9p7W9QWI9KIUl1bl4DHbnE9VBku xrm8k5hkaBix0lp0A5vvGP9Qxf9uZ2FD0b8l1Fm6Xk/q3HxbOac X-Google-Smtp-Source: AGHT+IGYoiUq9hLqdDhzQXAPvGDwZgTV3OTOBEHfhfMZ5TfTMnC+BZzwi6grw50t1TVvEnrlpUut5Ji/maPGx4WqxCY= X-Received: by 2002:a05:622a:5e0d:b0:4b4:8f03:9c43 with SMTP id d75a77b69052e-4b48f039e59mr48948401cf.29.1756998753246; Thu, 04 Sep 2025 08:12:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250828162951.60437-1-luis@igalia.com> <20250828162951.60437-2-luis@igalia.com> <87y0qul3mb.fsf@wotan.olymp> In-Reply-To: <87y0qul3mb.fsf@wotan.olymp> From: Miklos Szeredi Date: Thu, 4 Sep 2025 17:12:21 +0200 X-Gm-Features: Ac12FXx8qpQZ9xst0OSDZqziPMoq9ZJx5kTOnXlgc4SkVe1D4F_OHpOoeKH4bk0 Message-ID: Subject: Re: [RFC PATCH v5 1/2] fuse: new work queue to periodically invalidate expired dentries To: Luis Henriques Cc: Bernd Schubert , Laura Promberger , Dave Chinner , Matt Harvey , linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Thu, 4 Sept 2025 at 16:00, Luis Henriques wrote: > > Hi Miklos, > > On Thu, Sep 04 2025, Miklos Szeredi wrote: > > > On Thu, 28 Aug 2025 at 18:30, Luis Henriques wrote: > >> + if (!inval_wq && RB_EMPTY_NODE(&fd->node)) > >> + return; > > > > inval_wq can change to zero, which shouldn't prevent removing from the rbtree. > > Maybe I didn't understood your comment, but isn't that what's happening > here? If the 'fd' is in a tree, it will be removed, independently of the > 'inval_wq' value. I somehow thought it was || not &&. But I still don't see the point. The only caller already checked RB_EMPTY_NODE, so that is false. No race possible since it's called form the destruction of the dentry, and so this expression is guaranteed to evaluate to false. > (By the way, I considered using mutexes here instead. Do you have any > thoughts on this?) Use mutex where protected code might sleep, spin lock otherwise. > > What I don't understand in your comment is where you suggest these helpers > could be in a higher level. Could you elaborate on what exactly you have > in mind? E.g. void d_dispose_if_unused(struct dentry *dentry, struct list_head *dispose) { spin_lock(&dentry->d_lock); if (!dentry->d_lockref.count) to_shrink_list(dentry, dispose); spin_unlock(&dentry->d_lock); } Which is in fact taken from d_prune_aliases(), which could be modified to use this helper. Thanks, Miklos