All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Peng Tao <tao.peng@emc.com>
Cc: Sorin Faibish <sfaibish@emc.com>, <Trond.Myklebust@netapp.com>,
	<linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 3/3] pnfsblock: bail out unaligned DIO
Date: Mon, 28 May 2012 20:10:07 +0300	[thread overview]
Message-ID: <4FC3B16F.4020608@panasas.com> (raw)
In-Reply-To: <CA+a=Yy5SFqXPhSO0W4kttycNGjJLE-y_rTbDmQsTm+sgnjF6=Q@mail.gmail.com>

On 05/28/2012 07:50 PM, Peng Tao wrote:

>>> +static bool
>>> +bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
>>> +        struct nfs_page *req)
>>> +{
>>> +     /* Bail out page unligned IO */
>>> +     if (req->wb_offset || req->wb_pgbase ||
>>> +         req->wb_bytes != PAGE_CACHE_SIZE)
>>> +             return false;
>>> +
>>


But are you sure these above carry the corrected offsets/sizes.

I know from objlayout that these happen all the time. Is your
nfs_want_read_modify_write() fixes the original offset as well
as >wb_bytes to include more then submitted IO?

I believe you, but just make sure.

Perhaps a big fat dprint, so we can understand: "why the hell my
IO goes through MDS"

What you are saying is that this should not show up at all in prints
unless these corner cases you haven't tested for.

And do you have a test that fails which this patch now fixes?

>>
>> This is very serious. Not many applications will currently pass
>> this test. (And hence will not do direct IO)
>>
>> What happens today without this patch?
>>
> block layout IO path assumes IO is page aligned in many places.
> Without the patch, it is likely to cause data corruption when
> unaligned IO is passed in to LD. E.g., Page will be submitted to block
> layer entirely even if only part of its data is valid. Therefore if
> application does byte range locking + partial page write, garbage data
> will get written and cause data corruption.
> 
> In most buffered write cases, nfs_write_begin takes case of starting
> read-modify-write cycle for partial page writes. Please see
> nfs_want_read_modify_write(). I guess that's the reason we pass most
> test cases. But it is not always the case. And when it isn't, it may
> cause data corruption.
> 
> I'm really sorry to leave such serious bug here.
> 


Yes please make a small as possible fix to send to @stable.

> Thanks,
> Tao


Thanks
Boaz


      reply	other threads:[~2012-05-28 17:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27  5:32 [PATCH 0/3] NFS41: make block layout driver work w/ NFS DIO changes Peng Tao
2012-05-27  5:32 ` [PATCH 1/3] NFS41: add pnfs_dio_begin/dio_end Peng Tao
2012-05-27 16:29   ` Myklebust, Trond
2012-05-28  2:30     ` tao.peng
2012-05-28  3:42       ` Myklebust, Trond
2012-05-28  4:13         ` tao.peng
2012-05-28 10:44           ` Boaz Harrosh
2012-05-28 10:51             ` Boaz Harrosh
2012-05-28 17:14               ` Peng Tao
2012-05-28 17:24                 ` Boaz Harrosh
2012-05-28 17:36                   ` Peng Tao
2012-05-28 17:44                     ` Myklebust, Trond
2012-05-27  5:32 ` [PATCH 2/3] pnfsblock: call block plug in bl_dio_begin/end Peng Tao
2012-05-27  5:33 ` [PATCH 3/3] pnfsblock: bail out unaligned DIO Peng Tao
2012-05-27 16:38   ` Myklebust, Trond
2012-05-28  2:30     ` tao.peng
2012-05-28  3:45       ` Myklebust, Trond
2012-05-28  4:26         ` tao.peng
2012-05-28 16:33           ` Myklebust, Trond
2012-05-28 17:07             ` Peng Tao
2012-05-28 11:26       ` Boaz Harrosh
2012-05-28 16:50         ` Peng Tao
2012-05-28 17:10           ` Boaz Harrosh [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=4FC3B16F.4020608@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sfaibish@emc.com \
    --cc=tao.peng@emc.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.