Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp842533rdh; Thu, 23 Nov 2023 22:05:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IH71sTqJm20jfnOzQvwzNjeKhlrn2vYsQJeAmJgrepW57YC6UGRSROR4ssxCfKvt0Y7iFyJ X-Received: by 2002:a17:902:ab1d:b0:1cf:6b8f:5b0b with SMTP id ik29-20020a170902ab1d00b001cf6b8f5b0bmr1668666plb.4.1700805904495; Thu, 23 Nov 2023 22:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700805904; cv=none; d=google.com; s=arc-20160816; b=bWIrSEdFQCF9vAoSgzbKz0kP5MLz/7S9O4t4PR2JpHeTQqDMD4JzVDUkQX8uVs4ltC Q/fEqYgMfhUM+UFei1zfmqVdXjYNP/0ylroWHCWHs9ai/VsFlGlFxk6ZrkfKU4V3WrYA EZKuQyj6qI7R0k9xeXdC8zZDoMy/Lr592iixrGxoozY0q47MU/Y72eubunN/MjxPvphO /2wTm9z9mHgswxlV2bEdvdOvNKanHUJBLGIDkvwFuQS5uqXhsaRP0BlncgGZ2tiThd8l lVC8YqzYr2vWH6fHreELjNq7sEQpgOreudBuKylVJR6A1zRrfNddK+MEvpKN33TAy3y7 G2ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t2zwzPnF/uf/2oUVGi0n4GR0yi2cLzOWPO2ZTLid9cY=; fh=vDsv/0Rb6aybIi/Xas2DR+uQpFXMLtn4no3J1t38V0s=; b=vlvF37MV1EYl59nNs5UsxMxmozzswCZOxonB35MnCRHTPfhkUZ3dCk3kKteI2Oy5yE xm3qfbCQg8NWW5GqAVZk8VGv5pL8mUNblLliO/sqIpp+MNkRlCIdBvsP60iMBfKnvRzj LbeReh7EX4eM6rQCFOsXY1uHeG21mkQUM65EeShsdKfwLt5ZebTUewGzh53P1s+q4mRl EEc4+bGn8ShwZnHOk5cin8ZEUf7w0A6NkJ7A506gKVV45nHqTxqHc3RoPlrX6oOto2nN vHqC/AMOTK48NC/niF0uuQCBjFMKJmsxyE6Xv64yDbG+bgyI1DfvELo2Wc4vOWYrHADp mJcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="bzl/4PNt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u4-20020a17090282c400b001ca0a487ab2si2133883plz.200.2023.11.23.22.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 22:05:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="bzl/4PNt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4EF1980A7331; Thu, 23 Nov 2023 22:04:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbjKXGEf (ORCPT + 99 others); Fri, 24 Nov 2023 01:04:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjKXGER (ORCPT ); Fri, 24 Nov 2023 01:04:17 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03554D71; Thu, 23 Nov 2023 22:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=t2zwzPnF/uf/2oUVGi0n4GR0yi2cLzOWPO2ZTLid9cY=; b=bzl/4PNtx7A7UmHIJuWGbYesMX 3YBns84+Z3wUeS19etV4FUGGskdaoSPZZ35wqX46z7gSRPDYGO09ETLKALzHsMUpqgLREz9q0zQAe 08WzGcqFC7Bi49RK/90zKSBklXfKYhGySNc+hKFExGVBZsrUs7s7izI6Vx+kZsSWNygX4FXQjNjNV vZZRweGyBQIBWerpNK4ZPB/B9VGGWObgYRhBcuhAax6GJ0tWuYJl+0TEWJ6uCI6d8b4JKlHvG7Czz +oj0fsYCrvfQ/CbVELuI3K5rNQoGe8TU4fdy36JTMIo7YLRuP7p//WL91yRdqbr+nP0QBvbH5ClMg Au1GWXRw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r6PIc-002Ptf-25; Fri, 24 Nov 2023 06:04:22 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/21] coda_flag_children(): cope with dentries turning negative Date: Fri, 24 Nov 2023 06:04:03 +0000 Message-Id: <20231124060422.576198-2-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124060422.576198-1-viro@zeniv.linux.org.uk> References: <20231124060200.GR38156@ZenIV> <20231124060422.576198-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 23 Nov 2023 22:04:59 -0800 (PST) ->d_lock on parent does not stabilize ->d_inode of child. We don't do much with that inode in there, but we need at least to avoid struct inode getting freed under us... Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- fs/coda/cache.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 3b8c4513118f..bfbc03c6b632 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c @@ -92,13 +92,16 @@ static void coda_flag_children(struct dentry *parent, int flag) { struct dentry *de; + rcu_read_lock(); spin_lock(&parent->d_lock); list_for_each_entry(de, &parent->d_subdirs, d_child) { + struct inode *inode = d_inode_rcu(de); /* don't know what to do with negative dentries */ - if (d_inode(de) ) - coda_flag_inode(d_inode(de), flag); + if (inode) + coda_flag_inode(inode, flag); } spin_unlock(&parent->d_lock); + rcu_read_unlock(); return; } -- 2.39.2