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=1796387946; b=VA6y6GELaKBSv5pLoLr8Qz5KqnOObRz7P+2mRWr0gbGLMHd7j0UmEqkOeXbXACT0Zeh4 dGPlyN5iSjGGeQp4Wc4aZvTwdgzE0m/oWse2SNaJd8R/NABLWBdEAJIUYIzs/EqLiPhwa Sul2Qmem+qj+LT3HJ9oFKbrigPDcfgmYFSah8Nr/0qLYtvyxakj5c7xfIb2TXsL5/htFP bmwiAgfVkR7IUeNjnGlHaROyhsIJ7To5Fb263OY5jTHIGeT1GbJWkEmdDDek2JqJoVIOM V2FfxtFwzaqwSN1DSJy3L+EmrKpyM1Tv1J4ketR3R1fE82TFdOlfYCsb51/rtTy+g3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387946; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=T3zpcWDxmYY+f9caoDjML3x5Qna/9mdUGKPsJjts7lo=; b=jfEnaufjInMxLmSLv/DmwAN5o9peiiptc2wEnEKrAMAahW6EK8HOBltfyhO0EndJwr4f 1rB/Ul5To5bwXglNxF1Nzuypju0jzsYkg/j5XoOrmn2eTiI0tO7YHkGjeMfVH8F29Z5yQ ZvLzgdYjB8EGVrdy4b3tsOFZ8D6VnuwY/5NX4rHiAPPajFjpO7ZooQG23qg1YR2TzBCe2 yiBkh6z4nUzDQ8kqDuu0JUevPSF4wTXeuZuHawAuidX0BldQdftDTzuKl5fz4c048F9MR lD+BuIkj0LM04JqRg56L19JUBp7Fq7YTd6uy51FbhQeECTm7uW+Ni7VxP0RBlpgXPog== 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=qDbxKZKQ; 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 B8691606A32C; Fri, 4 Dec 2026 12:39:06 +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=qDbxKZKQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30EE81F000C2; Fri, 4 Dec 2026 12:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387946; bh=T3zpcWDxmYY+f9caoDjML3x5Qna/9mdUGKPsJjts7lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qDbxKZKQ6cgtpexe+zcPcGrTQVAnvu1GVaT2kR4cD3+z0C+plD1mnCto6wIPJg3nU 3gnErLESCEqE3KexU+c+vGVXwvrHrNsWqEjVir34Pn+e8dTdKuNHAcbgpXd1sphNe1 OR+FvREwgsn3j78R1hH0t9eOmKuBhEgcp4MaZQio= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tigran Mkrtchyan , Anna Schumaker , Sasha Levin Subject: [PATCH 6.1 0424/1059] pNFS/flexfiles: make pg_init retry loops killable Date: Fri, 4 Dec 2026 18:59:15 +0900 Message-ID: <20261204100655.316104845@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tigran Mkrtchyan [ Upstream commit fde27289503beabe7e0856dac164a5ced4be0342 ] When a task is killed while the pNFS client connects to a data server, nfs4_pnfs_ds_connect() fails with -ERESTARTSYS. If the layout has FF_FLAGS_NO_IO_THRU_MDS set, ff_layout_pg_init_read() cannot fall back to the MDS and retries after an uninterruptible ssleep. As the fatal signal stays pending, every new connect attempt is aborted the same way and the task loops forever without returning to user space: # grep -E 'SigPnd|ShdPnd' /proc/156021/status SigPnd: 0000000000000100 ShdPnd: 0000000000000100 # cat /proc/156021/stack msleep+0x2e/0x50 ff_layout_pg_init_read+0x267/0x310 [nfs_layout_flexfiles] __nfs_pageio_add_request+0x1c1/0x480 [nfs] nfs_pageio_add_request+0x21d/0x2c0 [nfs] nfs_read_add_folio+0x143/0x200 [nfs] nfs_readahead+0x204/0x290 [nfs] read_pages+0x62/0x230 page_cache_ra_unbounded+0x136/0x180 filemap_get_pages+0xf2/0x350 filemap_read+0xd5/0x320 nfs_file_read+0x6d/0xc0 [nfs] vfs_read+0x24f/0x3a0 __x64_sys_pread64+0x90/0xc0 do_syscall_64+0x5f/0xe0 Previous attempt propagates the error from nfs4_ff_layout_prepare_ds(), but only ff_layout_{read,write}_pagelist() look at it. The pg_init functions test IS_ERR() and retry on any error. Check for a fatal signal or an exiting task before sleeping in ff_layout_pg_init_read() and ff_layout_pg_init_write() and fail the I/O instead of retrying. Fixes: f06bedfa62d5 ("pNFS/flexfiles: don't attempt pnfs on fatal DS errors") Signed-off-by: Tigran Mkrtchyan Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/flexfilelayout/flexfilelayout.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 60f3fc26f0385..a9945db35ec81 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -819,6 +819,20 @@ ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio, return ff_layout_choose_best_ds_for_read(lseg, 0, best_idx); } +/* + * Wait before retrying pg_init. Returns false, with pgio->pg_error set, + * if the task was killed or is exiting and must not retry. + */ +static bool ff_layout_pg_retry_wait(struct nfs_pageio_descriptor *pgio) +{ + if (fatal_signal_pending(current) || nfs_current_task_exiting()) { + pgio->pg_error = -ERESTARTSYS; + return false; + } + ssleep(1); + return true; +} + static void ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req, @@ -877,7 +891,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, goto out_mds; pnfs_generic_pg_cleanup(pgio); /* Sleep for 1 second before retrying */ - ssleep(1); + if (!ff_layout_pg_retry_wait(pgio)) + return; goto retry; } @@ -916,7 +931,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, } pgio->pg_error = 0; /* Sleep for 1 second before retrying */ - ssleep(1); + if (!ff_layout_pg_retry_wait(pgio)) + return; goto retry; out_mds: trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode, @@ -965,7 +981,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, goto out_mds; pnfs_generic_pg_cleanup(pgio); /* Sleep for 1 second before retrying */ - ssleep(1); + if (!ff_layout_pg_retry_wait(pgio)) + return; goto retry; } pgm = &pgio->pg_mirrors[i]; -- 2.53.0