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=1796387253; b=HiHLiPGFVm0aGoPd3RYVdOUf1hrS88aB8vEsJ6eqc8EfbuiwzH9aHJiIIb8LiiZlWpwH 6zfwjgzG98oeRrSPAER1QNmWyvsGNXuVw0VSA2FZ77evpgBNYwOgQKbisgppfOSkj81gc 88LsXStk/Qz6/HRE2HJvjMjSZ5fn0law5Un2lhrQF+wtCay9NJB5AfX4CRzZe7H0cwLxx QH7z38eEE+0A8TgLosZxd+K1lwJEwm85t4onJ0QAob/crkXk2IgXTiHTwrmxVExVMn1X6 v59AITv3dCUN04JMEFVUBsink3mD6fw3qE8RLueqQhy1oI+rx5aGiUrATIfknGpEL+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387253; 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=bwU/U0NWP7p5e9DThnNK/OnpMYR+iOJIReRj4h1J7Nw=; b=nETm2cE5Y3fOv9gVOdmB6xHG19Zk6nPBOUm2lJV0yj36MsGrGjlRi13EqxsJxoVr++Dk ISHZ39FwnZUkvHYWTo8v1/ZtxWQl/YKchOWOYM9+ymFvsUTWW5msL+KQJuFK9qaUw3kym f4wfZ00jFg1JvrXfhhEEuNGo7c3eFslCoW4ken0hlgXEfYsmc39HKgGmLZohe30bBSSpi hIDCkgenXhkSgrp9C7/Cvk1aZnxhtF55S5lPQjiMOzMk9+dwRKBNcQFgeVzzoXdAKSESf SvLAbzc0/G4wtSApSUxqox/twVZGZjdBqVCY3q90QkDSMHJsxocyrPXesESMogbrN3g== 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=GdUoCFdH; 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 1F65D606A32D; Fri, 4 Dec 2026 12:27:33 +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=GdUoCFdH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 888BD1F000CE; Fri, 4 Dec 2026 12:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387253; bh=bwU/U0NWP7p5e9DThnNK/OnpMYR+iOJIReRj4h1J7Nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GdUoCFdH0AEAWh/2ukrYT0UozNcjzLFOMa7u6/EwwN81gICFrs5OxBQooWxCJoCjV ssNwv+t8v43NnrI2s0//glPr7jcA4UQ4RmV6Ns0My/3DqiciZS/KZeRekBrG7Cb8bz kcmrpxHqSLuQdxZnOw/QqFmhC6FaY1mGGKkokvUQ= 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.1 0167/1059] NFS: restore directory index when resuming readdir Date: Fri, 4 Dec 2026 18:54:58 +0900 Message-ID: <20261204100648.561318915@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: 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.1-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 8b6215e88515f..82175862356cc 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1242,6 +1242,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