[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080825014436.GT28946@ZenIV.linux.org.uk>
Date: Mon, 25 Aug 2008 02:44:36 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jan Harkes <jaharkes@...cmu.edu>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] readdir mess
PS: the part below was on top of patch from dwmw2; in the mainline the analog
of that sucker is in XFS.
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 8291591..77ad3a5 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1832,6 +1832,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,
> @@ -1842,8 +1843,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;
> @@ -1875,9 +1878,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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists