From patchwork Wed Dec 1 03:47:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 369611 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB13mnXn016769 for ; Wed, 1 Dec 2010 03:48:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754243Ab0LADrr (ORCPT ); Tue, 30 Nov 2010 22:47:47 -0500 Received: from mx2.netapp.com ([216.240.18.37]:9822 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754536Ab0LADrq (ORCPT ); Tue, 30 Nov 2010 22:47:46 -0500 X-IronPort-AV: E=Sophos;i="4.59,282,1288594800"; d="scan'208";a="489279740" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 30 Nov 2010 19:47:21 -0800 Received: from heimdal.trondhjem.org.com (heimdal.trondhjem.org [10.58.57.111] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id oB13lIjY018101; Tue, 30 Nov 2010 19:47:20 -0800 (PST) From: Trond Myklebust To: Linus Torvalds , Nick Bowler Cc: Linux Kernel Mailing List , linux-nfs@vger.kernel.org Subject: [PATCH 1/3] NFS: Ensure we use the correct cookie in nfs_readdir_xdr_filler Date: Tue, 30 Nov 2010 22:47:12 -0500 Message-Id: <1291175234-23824-2-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1291175234-23824-1-git-send-email-Trond.Myklebust@netapp.com> References: <1291175234-23824-1-git-send-email-Trond.Myklebust@netapp.com> In-Reply-To: References: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 03:48:50 +0000 (UTC) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index f0a384e..4a78d2b 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -178,6 +178,7 @@ typedef struct { struct page *page; unsigned long page_index; u64 *dir_cookie; + u64 last_cookie; loff_t current_index; decode_dirent_t decode; @@ -344,6 +345,8 @@ int nfs_readdir_search_array(nfs_readdir_descriptor_t *desc) else status = nfs_readdir_search_for_cookie(array, desc); + if (status == -EAGAIN) + desc->last_cookie = array->last_cookie; nfs_readdir_release_array(desc->page); out: return status; @@ -563,7 +566,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, unsigned int array_size = ARRAY_SIZE(pages); entry.prev_cookie = 0; - entry.cookie = *desc->dir_cookie; + entry.cookie = desc->last_cookie; entry.eof = 0; entry.fh = nfs_alloc_fhandle(); entry.fattr = nfs_alloc_fattr(); @@ -672,8 +675,10 @@ int readdir_search_pagecache(nfs_readdir_descriptor_t *desc) { int res; - if (desc->page_index == 0) + if (desc->page_index == 0) { desc->current_index = 0; + desc->last_cookie = 0; + } while (1) { res = find_cache_page(desc); if (res != -EAGAIN)