From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221085; b=wADUHPUjgzY1rFKufqE3fDSxZzBtstqV3VkykEeondrmTf1EPWXRrV9izgBLMUsjFnT/ eFmkUYivz3PxCf0P5R/vvYV/D5G/hhZjX/IumJrbFTHtkB1FGiTZleUXOGLijvzIgjpjF r6kDS9MqxlNpPrYTYYt63Eb+qvJlvBbKtyef5tKoh1sLrx+/nRDq6SI0UZYypUTyBP549 FkUl6tQQ0Vj0HG/PzOmngK36qbof09mXmqkefDGxGkc4bhwHuftdQbR+RVXreivDm4R+c GbZn2zWqH9ddKxVjdfRSw2YpjnfQIHkot9Qnz3ijotSUZeui4O4XVEeRlyyEim0A0OQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221085; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=YrK7qL/bYlfLiza7Bi0Bhf3Qkyv0nWjKKaaszeM/IRg=; b=N6MP1ER//0kNaOarV8M1aD5G+MSc1Oh3L7o+Vh2TuFEUr4UzVbO7LeIWQxzDyyOw7otO vrMZyUetXKS2GH8LdPgY+ThXF5PNSYjZQ/LvLmd5XTCojVOfxaDDFSG6WdXYb3UWbxH9i 0AzffdsBdSLf6YMLkGNZjGqIMLdJlQjmmyH/PC7rVo/u7oubimmoKvAL+IuSF6UtjRFoA KStbGGlBzHgsy9QT2bkoZFSvHhgXoQT2jLX/O0fWX/4DhryI2Lqo1a1AWWbaMOdfiKfFs lASBs4+Z/ZxUf7jWd7sSSLkHH9wfS5e2/ujvLVUfDGRFpzhs1xlUByp/gbHR+RlChzA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="q/BVfb7K"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1D74606A322 for ; Wed, 2 Dec 2026 14:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=q/BVfb7K Received: by smtp.kernel.org (Postfix) with ESMTPSA id B16E81F0089B; Wed, 2 Dec 2026 14:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221084; bh=YrK7qL/bYlfLiza7Bi0Bhf3Qkyv0nWjKKaaszeM/IRg=; h=Subject:To:Cc:From:Date; b=q/BVfb7K93JNnOUStJz+O0ND4Lk/7hYlGoEHZkLT6EJK6nvTsU1aC8IzOhf0sc/ld dU1vT8akt+sCqMgOR8FNXIqxCRcB7RV3DWcUcln98FI+id5BckXxlfILOTCp7VHg7h 21SvUZ3ITwBWrzAJ7FIuvAMCMY2aCkaBLsbNDhCs= Subject: FAILED: patch "[PATCH] fuse: preserve ENOTCONN after failed initialization and" failed to apply to 7.3-stable tree To: hengyul@cs.unc.edu,mszeredi@redhat.com Cc: From: Date: Wed, 02 Dec 2026 14:03:54 +0100 Message-ID: <2026120254-uplifting-daughter-6d2b@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 7.3-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y git checkout FETCH_HEAD git cherry-pick -x 2eb2329f9ce7f29f227656cc2686fe6f1879d11c # git commit -s git send-email --to '' --in-reply-to '2026120254-uplifting-daughter-6d2b@gregkh' --subject-prefix 'PATCH 7.3.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2eb2329f9ce7f29f227656cc2686fe6f1879d11c Mon Sep 17 00:00:00 2001 From: Hengyu Liang Date: Sat, 17 Oct 2026 05:46:01 -0400 Subject: [PATCH] fuse: preserve ENOTCONN after failed initialization and disconnect Commit 794e811d1443 ("fuse: split out filesystem part of request sending") moved the INIT failure check into fuse_req_prep(), before the channel checks whether it is still connected. If a daemon closes /dev/fuse before replying to INIT, aborting the channel completes INIT with an error. stat() and open() on the mount then return ECONNREFUSED instead of the previous ENOTCONN. The same change occurs when INIT is rejected before the daemon closes the fd. Record INIT failure in the channel before publishing initialized, and check it in fuse_get_req() after waiting for initialization and checking for disconnection. This preserves ECONNREFUSED for failed INIT while the device remains open, and restores ENOTCONN after disconnection. Set the failure flag only while the channel is connected, since abort also marks it initialized to wake waiters after a successful INIT. Fixes: 794e811d1443 ("fuse: split out filesystem part of request sending") Cc: stable@vger.kernel.org Signed-off-by: Hengyu Liang Signed-off-by: Miklos Szeredi diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 3641abb90d6b..ec2306c63d0d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -80,6 +80,10 @@ void fuse_chan_set_initialized(struct fuse_chan *fch, struct fuse_chan_param *pa fuse_uring_conn_init(fch); } + /* An aborted channel is also marked initialized to wake waiters. */ + if (!param && fch->connected) + fch->conn_refused = true; + /* Pairs with smp_load_acquire() readers of fch->initialized */ smp_store_release(&fch->initialized, 1); wake_up_all(&fch->blocked_waitq); @@ -130,6 +134,10 @@ static struct fuse_req *fuse_get_req(struct fuse_chan *fch, bool for_background) if (!fch->connected) goto out; + err = -ECONNREFUSED; + if (fch->conn_refused) + goto out; + req = fuse_request_alloc(fch, GFP_KERNEL); err = -ENOMEM; if (!req) { diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 4b412a76225f..0c078bdc270c 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -245,6 +245,9 @@ struct fuse_chan { /** Is interrupt not implemented by fs? */ bool no_interrupt; + /** @conn_refused: INIT failed while the channel was still connected. */ + bool conn_refused; + /* Use io_uring for communication */ unsigned int io_uring; diff --git a/fs/fuse/req.c b/fs/fuse/req.c index 6274a23af445..d96b947c61e6 100644 --- a/fs/fuse/req.c +++ b/fs/fuse/req.c @@ -49,20 +49,11 @@ static int fuse_fill_creds(struct fuse_mount *fm, struct fuse_args *args, return 0; } -static int fuse_req_prep(struct fuse_mount *fm, struct fuse_args *args, - const struct mnt_idmap *idmap) -{ - if (!args->force && fm->fc->conn_error) - return -ECONNREFUSED; - - return fuse_fill_creds(fm, args, idmap); -} - ssize_t __fuse_simple_request(const struct mnt_idmap *idmap, struct fuse_mount *fm, struct fuse_args *args) { struct fuse_conn *fc = fm->fc; - int err = fuse_req_prep(fm, args, idmap); + int err = fuse_fill_creds(fm, args, idmap); if (err) return err; @@ -77,7 +68,7 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args, gfp_t WARN_ON(args->force && !args->nocreds); - err = fuse_req_prep(fm, args, &invalid_mnt_idmap); + err = fuse_fill_creds(fm, args, &invalid_mnt_idmap); if (err) return err; @@ -92,7 +83,7 @@ int fuse_simple_notify_reply(struct fuse_mount *fm, struct fuse_args *args, u64 WARN_ON(args->force && !args->nocreds); - err = fuse_req_prep(fm, args, &invalid_mnt_idmap); + err = fuse_fill_creds(fm, args, &invalid_mnt_idmap); if (err) return err;