summaryrefslogtreecommitdiff
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-11-20 14:26:44 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-11-22 13:24:48 -0500
commit0b26a0bf6ff398185546432420bb772bcfdf8d94 (patch)
tree705b94c8662cf18cf8cd18c6b8c68d751d87acb7 /fs/nfs/dir.c
parent3020093f578fb6c9acc6914dfd887a1ebd1db659 (diff)
downloadlinux-3.10-0b26a0bf6ff398185546432420bb772bcfdf8d94.tar.gz
linux-3.10-0b26a0bf6ff398185546432420bb772bcfdf8d94.tar.bz2
linux-3.10-0b26a0bf6ff398185546432420bb772bcfdf8d94.zip
NFS: Ensure we return the dirent->d_type when it is known
Store the dirent->d_type in the struct nfs_cache_array_entry so that we can use it in getdents() calls. This fixes a regression with the new readdir code. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ced7291cc5f..8ea4a4180a8 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -162,6 +162,7 @@ struct nfs_cache_array_entry {
u64 cookie;
u64 ino;
struct qstr string;
+ unsigned char d_type;
};
struct nfs_cache_array {
@@ -265,6 +266,7 @@ int nfs_readdir_add_to_array(struct nfs_entry *entry, struct page *page)
cache_entry->cookie = entry->prev_cookie;
cache_entry->ino = entry->ino;
+ cache_entry->d_type = entry->d_type;
ret = nfs_readdir_make_qstr(&cache_entry->string, entry->name, entry->len);
if (ret)
goto out;
@@ -701,7 +703,6 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
int i = 0;
int res = 0;
struct nfs_cache_array *array = NULL;
- unsigned int d_type = DT_UNKNOWN;
array = nfs_readdir_get_array(desc->page);
if (IS_ERR(array)) {
@@ -711,11 +712,11 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
for (i = desc->cache_entry_index; i < array->size; i++) {
struct nfs_cache_array_entry *ent;
- d_type = DT_UNKNOWN;
ent = &array->array[i];
if (filldir(dirent, ent->string.name, ent->string.len,
- file->f_pos, nfs_compat_user_ino64(ent->ino), d_type) < 0) {
+ file->f_pos, nfs_compat_user_ino64(ent->ino),
+ ent->d_type) < 0) {
desc->eof = 1;
break;
}