From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Neil Brown <neilb@suse.de>
Cc: nfs@lists.sourceforge.net,
Norman Weathers <norman.r.weathers@conocophillips.com>
Subject: Re: Broken nfsd in recent kernels
Date: Tue, 13 Feb 2007 15:50:22 +1100 [thread overview]
Message-ID: <45D1438E.6090001@yahoo.com.au> (raw)
In-Reply-To: <17873.16504.979464.1957@notabene.brown>
Neil Brown wrote:
> On Tuesday February 13, nickpiggin@yahoo.com.au wrote:
>>It would be interesting to know whether Norman's test case actually is
>>using writev...
>
>
> He is just use NFS. NFSD does use writev.
OK that makes a lot of sense.
> A typical 32K write arrives as a bunch of IP packets most of which
> hold 1448 bytes. These are all presented to the filesystem in a
> writev (vfs_writev actually).
>
> I presume the problem is that we cannot fault_in_pages_readable two
> different buffers as the first might disappear while the second is
> being paged in....
Yeah that, and also I don't think we ever actually did the
fault_in_pages_readable for subsequent segments past the first one,
so it could be quite trivial to trigger the problem delibrately.
> Would it be possible to count how much of the iovec is in
> kernel-space, or maybe how much is *not* part of the file being
> written too, and allow that much to be processed all at once?
> Or is there something more subtle that I am missing?
>
> The following patch is rather gross, but seems to work and should be
> safe... what do you think?
I think it seems like a very good idea. There is no reason to worry
about faults if we're dealing with kernel constructed buffers.
>
> NeilBrown
>
> Signed-off-by: Neil Brown <neilb@suse.de>
>
> diff .prev/mm/filemap.c ./mm/filemap.c
> --- .prev/mm/filemap.c 2007-02-13 15:10:32.000000000 +1100
> +++ ./mm/filemap.c 2007-02-13 15:19:20.000000000 +1100
> @@ -2163,9 +2163,11 @@ generic_file_buffered_write(struct kiocb
> /*
> * Limit the size of the copy to that of the current segment,
> * because fault_in_pages_readable() doesn't know how to walk
> - * segments.
> + * segments, but don't worry about such technicalities if nfsd
> + * is writing, as prefault isn't needed then.
> */
> - bytes = min(bytes, cur_iov->iov_len - iov_base);
> + if (!segment_eq(get_fs(), KERNEL_DS))
> + bytes = min(bytes, cur_iov->iov_len - iov_base);
>
> /*
> * Bring in the user page that we will copy from _first_.
> @@ -2173,7 +2175,8 @@ generic_file_buffered_write(struct kiocb
> * same page as we're writing to, without it being marked
> * up-to-date.
> */
> - fault_in_pages_readable(buf, bytes);
> + if (!segment_eq(get_fs(), KERNEL_DS))
> + fault_in_pages_readable(buf, bytes);
>
> page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec);
> if (!page) {
>
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
prev parent reply other threads:[~2007-02-13 4:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-13 0:26 Broken nfsd in recent kernels Norman Weathers
2007-02-13 3:48 ` Neil Brown
2007-02-13 3:58 ` Nick Piggin
2007-02-13 4:37 ` Neil Brown
2007-02-13 4:50 ` Nick Piggin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45D1438E.6090001@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=neilb@suse.de \
--cc=nfs@lists.sourceforge.net \
--cc=norman.r.weathers@conocophillips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.