From patchwork Sun Nov 21 19:21:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 346051 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 oALJLpo6014641 for ; Sun, 21 Nov 2010 19:21:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754993Ab0KUTVq (ORCPT ); Sun, 21 Nov 2010 14:21:46 -0500 Received: from mx2.netapp.com ([216.240.18.37]:49411 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575Ab0KUTVp (ORCPT ); Sun, 21 Nov 2010 14:21:45 -0500 X-IronPort-AV: E=Sophos;i="4.59,232,1288594800"; d="scan'208";a="485296815" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 21 Nov 2010 11:21:31 -0800 Received: from heimdal.trondhjem.org.com ([10.58.57.137]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id oALJLTjX027910; Sun, 21 Nov 2010 11:21:30 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/8] NFS: Assume eof if the server returns no readdir records Date: Sun, 21 Nov 2010 14:21:16 -0500 Message-Id: <1290367282-5445-2-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1290367282-5445-1-git-send-email-Trond.Myklebust@netapp.com> References: <1290367282-5445-1-git-send-email-Trond.Myklebust@netapp.com> 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]); Sun, 21 Nov 2010 19:21:52 +0000 (UTC) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 662df2a..2789cb3 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -466,8 +466,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en struct xdr_stream stream; struct xdr_buf buf; __be32 *ptr = xdr_page; - int status; struct nfs_cache_array *array; + unsigned int count = 0; + int status; buf.head->iov_base = xdr_page; buf.head->iov_len = buflen; @@ -488,6 +489,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en break; } + count++; + if (desc->plus == 1) nfs_prime_dcache(desc->file->f_path.dentry, entry); @@ -496,13 +499,14 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en break; } while (!entry->eof); - if (status == -EBADCOOKIE && entry->eof) { + if (count == 0 || (status == -EBADCOOKIE && entry->eof == 1)) { array = nfs_readdir_get_array(page); if (!IS_ERR(array)) { array->eof_index = array->size; status = 0; nfs_readdir_release_array(page); - } + } else + status = PTR_ERR(array); } return status; }