summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-08-24 13:29:52 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-23 11:13:10 +0200
commit53c9c5c0e32c69f9df1822e47671c13e3402c82f (patch)
tree76aae2cfde109c97451d40b5c6e5063e22690a03 /fs/nfsd
parent[PATCH] get rid of on-stack dentry in ext2_get_parent() (diff)
downloadlinux-53c9c5c0e32c69f9df1822e47671c13e3402c82f.tar.xz
linux-53c9c5c0e32c69f9df1822e47671c13e3402c82f.zip
[PATCH] prepare vfs_readdir() callers to returning filldir result
It's not the final state, but it allows moving ->readdir() instances to passing filldir return value to caller of vfs_readdir(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/vfs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 93b22f661d9d..e3e37f7c8477 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1831,6 +1831,7 @@ struct buffered_dirent {
struct readdir_data {
char *dirent;
size_t used;
+ int full;
};
static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen,
@@ -1841,8 +1842,10 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen,
unsigned int reclen;
reclen = ALIGN(sizeof(struct buffered_dirent) + namlen, sizeof(u64));
- if (buf->used + reclen > PAGE_SIZE)
+ if (buf->used + reclen > PAGE_SIZE) {
+ buf->full = 1;
return -EINVAL;
+ }
de->namlen = namlen;
de->offset = offset;
@@ -1874,9 +1877,13 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
unsigned int reclen;
buf.used = 0;
+ buf.full = 0;
host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf);
- if (host_err)
+ if (buf.full)
+ host_err = 0;
+
+ if (host_err < 0)
break;
size = buf.used;