From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796122744; b=gDrxy4P/OITqGDz3mlwWpCJdpHhcYcxbgB3bt4PM6je9OqmN3b2xMqIN3HkSrt2cQx8E vjC416H08qPrszEDFzYVaVftgcXmy31bF4jw0bvXweDgivX3atnYf/lzLv0ac9e6gzmyl WxQNVKO9m2zF0HILGMcyRIbM8eQ37+yyt4iwAnf/CuSRcyksbL9JqiB60CMJ7Smx7FZp7 tByYZVIKy/3dSM6F447R3QiKwU5O72K90YoO1446Ag11qlXXkA2UsxnjsDoRW84EMKoNf Rc8rJBsjT7eoJ8A4reAEEhEY81dHPEaJI+A9ocgKfgTDmibyUga46smHavS9T3ypmZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796122744; h=DMARC-Filter:DKIM-Signature:X-MC-Rep:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-Mimecast-Spam-Score: X-Mimecast-MFC-PROC-ID:X-Mimecast-Originator: Content-Transfer-Encoding:content-type; bh=hoLoCywEjKsAGFH4/oL1SJ9AksF1s+WcvzVytXvtBpg=; b=Ng9Qc/d8b9kFPEO5bXSzP5GaoypzUrS6EH5u5ZHGoVUtCkgNDZJ2TNGGGCCJAhqASdbh l/YPpN8RcDxkPxmg5wimRqw1zQTS9Tun8qigEkmRCro7NdBm8raad89vCAub5vOIljiAO i8NBqwP5mA9ZW+fBz17XaDPzGyB/HQX1Cvsyt8zRRg2WOYjyDBl2v2M1ueiEVnib6+uMz hbu7FHcX6pP9MOvpxNIacgGmk4kl2FTB9JTmrFva8arg21qRvfgV1+gX99yCJe12nDgif q5kn1c+gcmi3VieLD0J08cIaIfnRGwTmKbqNThWZHlvTMvlcGVyQ3Tzun9YH6vDhi9Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Uc0U5oy1; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55B79606A31A for ; Tue, 1 Dec 2026 10:59:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55B79606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Uc0U5oy1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796122744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hoLoCywEjKsAGFH4/oL1SJ9AksF1s+WcvzVytXvtBpg=; b=Uc0U5oy1tQR14IvdLmI1545E4asnx4vMxw6mMPVU7TracO80FXtjUnPKdROEZQQ7TB8fgU JrPVqpnXO9C0sXotW7qM+FSoqGIgfv+XyZgXJRzqtOGznnLppNzPQ6I7BQYi0m6eAvXM24 uxSzWXAp2C5v9uo3eaFHIGl+6IUnLWI= X-MC-Rep: binary re single Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-L5EDpEdQOB2ZuHVeWbh6CA-1; Tue, 1 Dec 2026 10:59:01 +0000 X-MC-Unique: L5EDpEdQOB2ZuHVeWbh6CA-1 X-Mimecast-MFC-AGG-ID: L5EDpEdQOB2ZuHVeWbh6CA_1796122740 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4a7c864000eso6793667f8f.0 for ; Tue, 01 Dec 2026 02:59:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796122740; x=1796727540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hoLoCywEjKsAGFH4/oL1SJ9AksF1s+WcvzVytXvtBpg=; b=IQOArlN3H+boNKkyzcCDx0WvccBHpxqpu9NTHCbsxITvJ7lZeOz2EyTyhiegT8Aa9+ 192VGfGX6I3qM2vvCwRPEGx56mnjiP2KvnXc2LhJfl8lrrHj04qt0qLj8mCZWf42v+Pp OUTxt+aCpYZdL4BBLtSb//EO/1Dob9dbGMu/2W46GAsfhwPB5sSNrrY8juddYyPp+8P3 HFR2sHiRL7dvqchhcIBV4BW2VIhlJg+1kyrPlaOjkW3jHWVG0PkGHG8j150IlHbYO81c NDVDkBKvzw7REYe3tSGDsUAlNGdtZw3hsiXIUuhlbEhuioYdDQUr/ca6EaB2oQH7gm1i 6lSA== X-Forwarded-Encrypted: i=1; AL+hErHIiuQnnnDxG+M4nQao0hq5TVK/kzHE3F+YVfNBi+KebX+M025YhLm0q/wKZdClXxztCIydL3ZdSpKTAamc9A==@lists.linux.dev X-Gm-Message-State: APuU4Z/JtbEjdD5yjUKV/6edxPeo2eBLv4SMOYo2qZiXTbNRmpsDXxo3 nX79k5tY8l23Lf/oL94Zl8Rmk3njpZlR7A6O2AXJl1RAlkS/RSFG7fPvqdFWA0URREfOI7AsbIj z+1zLLBwO/zdOODuPjSneIBQbY1xSp4lWUY2p2sOUMUM/WgNrlAmjrav9uCJzVdDF7wrQf//dY+ qT X-Gm-Gg: AZFdTZfoi043Utgdxn4D2R2OjsXParsx4f9uaWHHKb4k8bNdhCZHRLub6QtoDzHkHeX wLJx3eVcrcIBfFIzwYg7Gpwhv0QbLLNu+zCTVXkuOK7XN05juFKnReEYmuzQAwvXBfuvnDq2Qez 1BQ1UCYfukihruPdiQVJ7cDaSwd1mUXrO77mtEcTIXHAriCADyu6SAMJ1tfvEi/GnirKqGER9rX o6wz0Or4ULHotFCGkcxNaGUvkhRIsJ4/wtbzHghAos0Q8/+GQekiH4uMjyVN+MJm9fP0QPjqfk/ +4yM66K5norDm19NBZUCLlerYRAFCpBAh2+vxmq9uF2iRpBjrn+PBlIQyjEBj7di2C4/MgXAb5F 7as8ZRb50xb+JnU6jVe70NV92cKkEzN9U8QM+asWKSZK4MfILX//s5hkePUxfwy1t6RCgf0gusB WXTe8urcEuHT13//cAbgkgOpkgN07pF67tsWZ1CdGB X-Received: by 2002:a05:6000:1865:b0:4b8:75e5:301d with SMTP id ffacd0b85a97d-4b875e5306amr48959929f8f.0.1796122740436; Tue, 01 Dec 2026 02:59:00 -0800 (PST) X-Received: by 2002:a05:6000:1865:b0:4b8:75e5:301d with SMTP id ffacd0b85a97d-4b875e5306amr48959875f8f.0.1796122739871; Tue, 01 Dec 2026 02:58:59 -0800 (PST) Received: from mszeredi-thinkpadt14gen6.redhat.corp (193-226-214-34.pool.digikabel.hu. [193.226.214.34]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab69bf685asm72464829f8f.20.2026.12.01.02.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 02:58:59 -0800 (PST) From: Miklos Szeredi To: fuse-devel@lists.linux.dev, virtualization@lists.linux.dev Cc: Li Wang , German Maglione , Stefan Hajnoczi Subject: [PATCH v3 4/5] fuse: don't take a lookup count on the root inode Date: Tue, 1 Dec 2026 11:58:52 +0100 Message-ID: <20261201105855.430993-4-mszeredi@redhat.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201105855.430993-1-mszeredi@redhat.com> References: <20261201105855.430993-1-mszeredi@redhat.com> X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qdKpb_Yyp2Az08hJFXeFzGGrfqJ3YkQoNBl-3Va-4CI_1796122740 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true The root inode is not obtained through a lookup, so the server holds no lookup count for FUSE_ROOT_ID and must never be sent a FUSE_FORGET for it. fuse_iget() increments nlookup for every inode it instantiates, though, leaving the root with a lookup count of one that does not correspond to anything on the server side. This is harmless today: the root inode is pinned by sb->s_root for the lifetime of the mount, and the only eviction happens from generic_shutdown_super(), which clears SB_ACTIVE before calling evict_inodes(), so fuse_evict_inode() never acts on the count. That makes the invariant depend on eviction ordering rather than on anything explicit, which is a trap for future changes to that logic. Drop the bogus reference where it is taken, the same way fuse_fill_super_submount() already does for the duplicate root of a submount. No functional change. Signed-off-by: Miklos Szeredi --- fs/fuse/inode.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 344fcb55a64b..7849cbbdcab6 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1085,12 +1085,23 @@ dev_t fuse_conn_get_id(struct fuse_conn *fc) static struct inode *fuse_get_root_inode(struct super_block *sb, unsigned int mode) { struct fuse_attr attr; + struct inode *inode; + memset(&attr, 0, sizeof(attr)); attr.mode = mode; attr.ino = FUSE_ROOT_ID; attr.nlink = 1; - return fuse_iget(sb, FUSE_ROOT_ID, 0, &attr, 0, 0, 0); + inode = fuse_iget(sb, FUSE_ROOT_ID, 0, &attr, 0, 0, 0); + /* + * The root is not looked up, so the server holds no lookup count for + * it and must never be sent a FUSE_FORGET for FUSE_ROOT_ID. + * fuse_iget() incremented nlookup, though, so undo it here. + */ + if (inode) + get_fuse_inode(inode)->nlookup--; + + return inode; } struct fuse_inode_handle { -- 2.56.1