Skip to content

Commit

Permalink
NFS: Ensure that we update the readdir filp->f_pos correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 23, 2011
1 parent 51e8165 commit e47c085
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e47c085

Please sign in to comment.