[1/3] NFS: Ensure that we update the readdir filp->f_pos correctly
diff mbox

Message ID 4D8A305D.9010803@netapp.com
State New, archived
Headers show

Commit Message

Bryan Schumaker March 23, 2011, 5:39 p.m. UTC
None

Patch
diff mbox

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index f685f15..a9824ce 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -291,7 +291,6 @@  int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descri
 	if (diff >= array->size) {
 		if (array->eof_index >= 0)
 			goto out_eof;
-		desc->current_index += array->size;
 		return -EAGAIN;
 	}
 
@@ -312,6 +311,7 @@  int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des
 
 	for (i = 0; i < array->size; i++) {
 		if (array->array[i].cookie == *desc->dir_cookie) {
+			desc->file->f_pos = desc->current_index + i;
 			desc->cache_entry_index = i;
 			return 0;
 		}
@@ -343,6 +343,7 @@  int nfs_readdir_search_array(nfs_readdir_descriptor_t *desc)
 
 	if (status == -EAGAIN) {
 		desc->last_cookie = array->last_cookie;
+		desc->current_index += array->size;
 		desc->page_index++;
 	}
 	nfs_readdir_release_array(desc->page);