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=1796384600; b=tOzfHIe2jFy2M6f6aEtU9lnFkVO+E5VEs/1zxYP3+8uxmoLFN+XMS3ddFb5PEmLsBF6M MjvfInhoZ/EFguAHKORSSDKrH8cmq7PvU9NUiwIT3iN3VhKPv73DF3m79Bw/rzBq9jHew 6Hh62E2NNE3ARZRq65WmADgR8/MYohrbtNfYd47YRnsJsyyhktWegW+4dIsbMzSJS+Js3 CQ0zJt2zj6bL1DdIUZVzaaoazAhkgpbUdNILrPCO0gHCGxcGbpePRCaW/pV9NRTAL5S4g h79PVCUz96yYn56ZEdeeH/SEdaILfd1dIY44/QiJFhhA8yQ/wT6pKYzwvvYM036mH5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384600; 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=tlwG6ekPgr74fnjr+gmVMoF7JH0xSb+ld5Z1KaDhvLk=; b=QslNL7mVX4dut0rdnUgGjdSKmGOxQmhlw3dw9nLxFRpQdMvKUzzYTZej10QiOQ2vPrhP eIkldE1LFYXq3Dm+7xj1c6jbSLIy7efqMj4NVrn//dGxaJrUrW17OITbg3tf7f4DaOYtL nM7Us8IFH1SF7TjSBYL567yI63h6xTqaUtD0gcYggBR/+1NXb8DoEDZRTtjjwUIcQPqPO DbPKPU2hs0lokZuHCxaELpPu7Ta//NBnJxXcBOZJRlsotONRXJpZ486y6JFPsyG1HktaI q1XwJWmmSAq5BMIv9MPFY62lSg8F3UVe+I3grM9eIrBjaf/YTjyJ3uke6OKPi2Ufnag== 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=maPE7f2z; 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 351AC606A322; Fri, 4 Dec 2026 11:43:20 +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=maPE7f2z Received: by smtp.kernel.org (Postfix) with ESMTPSA id 362271F000CE; Fri, 4 Dec 2026 11:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384599; bh=tlwG6ekPgr74fnjr+gmVMoF7JH0xSb+ld5Z1KaDhvLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=maPE7f2zXgIQGTHXSvVYiOSMpZNe0g0SvKjEc87wcQTuuXiYm5VY09ynhxfguu2lr Cem3pfwQst2sBxN6loM9v1chTe4ED1hRIgO9AyHE8DHz79kcePZFvN89frJlSN9hhY RdTI3yUEOwL+dyRkQ7wfmt6rM+ZEWBgaUpD+/ao4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Avi Weiss , Anna Schumaker , Sasha Levin Subject: [PATCH 6.6 0218/1167] NFS: restore directory index when resuming readdir Date: Fri, 4 Dec 2026 18:54:05 +0900 Message-ID: <20261204100707.749350421@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Avi Weiss [ Upstream commit 89b91409b2342e7629b1271eba315a0f06495247 ] nfs_readdir() restores the cached folio index and cookie when resuming directory iteration, but leaves current_index at zero. In 32-bit index mode, nfs_readdir_search_for_cookie() then reports a folio-relative offset instead of the absolute entry position. Restore current_index from the saved logical folio index before searching the cache. This solution relies on the current behavior of nfs_readdir_seek_next_array(), where folio_index advances by one and current_index advances by nfs_readdir_array_maxentries() for each full, nonterminal folio. Fixes: f648022faa68e ("NFS: Convert readdir page cache to use a cookie based index") Signed-off-by: Avi Weiss Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b51424a12a5ce..77a55abd627dc 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1251,6 +1251,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) spin_lock(&file->f_lock); desc->dir_cookie = dir_ctx->dir_cookie; desc->folio_index = dir_ctx->page_index; + desc->current_index = (loff_t)desc->folio_index * + nfs_readdir_array_maxentries(); desc->last_cookie = dir_ctx->last_cookie; desc->attr_gencount = dir_ctx->attr_gencount; desc->eof = dir_ctx->eof; -- 2.53.0