NFS: Don't ignore errors from nfs_do_filldir()
We should ignore the errors from the filldir callback, and just interpret them as meaning we should exit, however we should definitely pass back ENOMEM errors. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
18
fs/nfs/dir.c
18
fs/nfs/dir.c
@@ -709,13 +709,15 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = desc->cache_entry_index; i < array->size; i++) {
|
for (i = desc->cache_entry_index; i < array->size; i++) {
|
||||||
|
struct nfs_cache_array_entry *ent;
|
||||||
d_type = DT_UNKNOWN;
|
d_type = DT_UNKNOWN;
|
||||||
|
|
||||||
res = filldir(dirent, array->array[i].string.name,
|
ent = &array->array[i];
|
||||||
array->array[i].string.len, file->f_pos,
|
if (filldir(dirent, ent->string.name, ent->string.len,
|
||||||
nfs_compat_user_ino64(array->array[i].ino), d_type);
|
file->f_pos, nfs_compat_user_ino64(ent->ino), d_type) < 0) {
|
||||||
if (res < 0)
|
desc->eof = 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
file->f_pos++;
|
file->f_pos++;
|
||||||
desc->cache_entry_index = i;
|
desc->cache_entry_index = i;
|
||||||
if (i < (array->size-1))
|
if (i < (array->size-1))
|
||||||
@@ -820,14 +822,14 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
|||||||
res = readdir_search_pagecache(desc);
|
res = readdir_search_pagecache(desc);
|
||||||
|
|
||||||
if (res == -EBADCOOKIE) {
|
if (res == -EBADCOOKIE) {
|
||||||
|
res = 0;
|
||||||
/* This means either end of directory */
|
/* This means either end of directory */
|
||||||
if (*desc->dir_cookie && desc->eof == 0) {
|
if (*desc->dir_cookie && desc->eof == 0) {
|
||||||
/* Or that the server has 'lost' a cookie */
|
/* Or that the server has 'lost' a cookie */
|
||||||
res = uncached_readdir(desc, dirent, filldir);
|
res = uncached_readdir(desc, dirent, filldir);
|
||||||
if (res >= 0)
|
if (res == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
res = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == -ETOOSMALL && desc->plus) {
|
if (res == -ETOOSMALL && desc->plus) {
|
||||||
@@ -842,11 +844,9 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
res = nfs_do_filldir(desc, dirent, filldir);
|
res = nfs_do_filldir(desc, dirent, filldir);
|
||||||
if (res < 0) {
|
if (res < 0)
|
||||||
res = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
out:
|
out:
|
||||||
nfs_unblock_sillyrename(dentry);
|
nfs_unblock_sillyrename(dentry);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
|
Reference in New Issue
Block a user