NFS: Ensure that we update the readdir filp->f_pos correctly
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 23 Mar 2011 12:43:09 +0000 (08:43 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 23 Mar 2011 19:12:12 +0000 (15:12 -0400)
If we're doing a search by readdir cookie, we need to ensure that the
resulting f_pos is updated. To do so, we need to update the
desc->current_index, in the same way that we do in the search by
file offset case.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/dir.c

index 2c3eb33b904dcd0b224d27910c95b5fa8225f3b9..c5c71cb62fbd5c7396264ffb94eeb93c4ea6a8f7 100644 (file)
@@ -290,7 +290,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;
        }
 
@@ -311,6 +310,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;
                }
@@ -342,6 +342,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);
This page took 0.029449 seconds and 5 git commands to generate.