From: Alex Bligh <alex@alex.org.uk>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Myklebust, Trond" <Trond.Myklebust@netapp.com>,
Peter Staubach <pstaubach@exagrid.com>,
linux-nfs@vger.kernel.org, Alex Bligh <alex@alex.org.uk>
Subject: Re: Fatal crash with NFS, AIO & tcp retransmit
Date: Thu, 24 Jan 2013 12:00:14 +0000 [thread overview]
Message-ID: <F48D1289B377F7EC54BA1FE0@nimrod.local> (raw)
In-Reply-To: <1359024131.17440.123.camel@zakaz.uk.xensource.com>
Ian,
--On 24 January 2013 10:42:11 +0000 Ian Campbell <Ian.Campbell@citrix.com>
wrote:
> This is exactly what can happen:
>
> 1. send request (A)
> 2. timeout waiting for ACK to (A)
> 3. queue TCP retransmit of (A) as (B)
> 4. receive ACK to original (A), sent at #1, and rpc reply to that
> request.
> 5. return success to userspace
> 6. userspace reuses (or unmaps under Xen) the buffer
> 7. (B), queued at #3, reaches the head of the queue
> 8. Try to transmit (B), bug has now happened.
>
> You can also s/TCP/RPC/ and construct a similar issue at the next layer
> of the stack, which only happens on NFSv3 AIUI.
Got it - finally! Thanks for your patience in explaining.
I am guessing a simpler fix for the tcp retransmit problem would be
to copy (or optionally copy) the page(s) for B at step 3. Given tcp
retransmit is infrequent and performance is not going to be good
with tcp retransmissions going on anyway, that might be acceptable.
However in practice *anything* that causes a multiple references
to a page in the networking stack is going to have this problem,
and multiple skbuff's can refer to the same page, which is I presume
why you were fixing this by skbuff reference counting, presumably
so you know you can do (5) only when the skbuff is entirely unreferenced
(i.e. after (8)).
>> My understanding (which may well be completely wrong) is that the problem
>> was that xen was unmapping the page even though it still had kernel
>> references to it. This is why the problem does not happen in kvm (which
>> does not as I understand it do a similar map/unmap operation). From Ian
>> C I understand that just looking at the number of kernel references is
>> not sufficient.
>
> Under any userspace process (which includes KVM) you get retransmission
> of data which may have changed, because userspace believes the kernel
> when it has said it is done with it, and has reused the buffer. All that
> is different under Xen is that "changed" can mean "unmapped" which makes
> the symptom much worse.
Indeed. And the fact that kvm by default does not use O_DIRECT whereas
xen_disk.c does, so kvm will hide the problem as a copy is performed in (1).
--
Alex Bligh
prev parent reply other threads:[~2013-01-24 12:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 13:06 Fatal crash with NFS, AIO & tcp retransmit Alex Bligh
2013-01-21 14:38 ` Myklebust, Trond
2013-01-21 15:01 ` Alex Bligh
2013-01-21 15:10 ` Alex Bligh
2013-01-21 15:21 ` Ian Campbell
2013-01-25 13:45 ` Alex Bligh
2013-01-21 15:50 ` Myklebust, Trond
2013-01-21 15:54 ` Ian Campbell
2013-01-21 17:12 ` Alex Bligh
2013-01-21 17:20 ` Myklebust, Trond
2013-01-21 17:29 ` Alex Bligh
2013-01-23 15:22 ` Alex Bligh
2013-01-23 15:34 ` Myklebust, Trond
2013-01-23 17:33 ` Alex Bligh
2013-01-23 17:37 ` Myklebust, Trond
2013-01-23 17:42 ` Alex Bligh
2013-01-23 17:48 ` Peter Staubach
2013-01-23 18:13 ` Myklebust, Trond
2013-01-23 19:37 ` Alex Bligh
2013-01-24 10:42 ` Ian Campbell
2013-01-24 12:00 ` Alex Bligh [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=F48D1289B377F7EC54BA1FE0@nimrod.local \
--to=alex@alex.org.uk \
--cc=Ian.Campbell@citrix.com \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=pstaubach@exagrid.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox