linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Jeff Layton <jlayton@redhat.com>
Cc: Steve French <smfrench@gmail.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	pbadari@us.ibm.com,
	"linux-cifs-client@lists.samba.org"
	<linux-cifs-client@lists.samba.org>
Subject: Re: [linux-cifs-client] Re: fsx-linux failing with latest cifs-2.6 git tree
Date: Mon, 1 Dec 2008 09:44:35 +0100	[thread overview]
Message-ID: <20081201084435.GE2529@wotan.suse.de> (raw)
In-Reply-To: <20081130171734.3c37e1b9@tupile.poochiereds.net>

On Sun, Nov 30, 2008 at 05:17:34PM -0500, Jeff Layton wrote:
> On Sun, 30 Nov 2008 15:44:21 -0600
> "Steve French" <smfrench@gmail.com> wrote:
> 
> > On Fri, Nov 28, 2008 at 6:18 AM, Jeff Layton <jlayton@redhat.com> wrote:
> > >> One minor thing -- you could do the !PageUptodate check first? If the
> > >> page is already uptodate, then everything is much simpler I think? (and
> > >> PageChecked should not be set).
> > >>
> > >> if (!PageUptodate(page)) {
> > >>     if (PageChecked(page)) {
> > >>         if (copied == len)
> > >>             SetPageUptodate(page);
> > >>         ClearPageChecked(page);
> > >>     } else if (copied == PAGE_CACHE_SIZE)
> > >>         SetPageUptodate(page);
> > >> }
> > >>
> > >> I don't know if you think that's better or not, but I really like to
> > >> make it clear that this is the !PageUptodate logic, and we never try
> > >> to SetPageUptodate on an already uptodate page.
> > >>
> > >> But I guess it is just a matter of style. So go with whatever you like
> > >> best.
> > > --------------[snip]---------------
> > > Subject: [PATCH] cifs: clean up conditionals in cifs_write_end
> > >
> > > Make it clear that the conditionals at the start of cifs_write_end are
> > > just for the situation when the page is not uptodate.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > > ---
> > >  fs/cifs/file.c |   12 +++++++-----
> > >  1 files changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> > > index f0a81e6..202a20f 100644
> > > --- a/fs/cifs/file.c
> > > +++ b/fs/cifs/file.c
> > > @@ -1475,12 +1475,14 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
> > >        cFYI(1, ("write_end for page %p from pos %lld with %d bytes",
> > >                 page, pos, copied));
> > >
> > > -       if (PageChecked(page)) {
> > > -               if (copied == len)
> > > +       if (!PageUptodate(page)) {
> > > +               if (PageChecked(page)) {
> > > +                       if (copied == len)
> > > +                               SetPageUptodate(page);
> > > +                       ClearPageChecked(page);
> > > +               } else if (copied == PAGE_CACHE_SIZE)
> > >                        SetPageUptodate(page);
> > > -               ClearPageChecked(page);
> > > -       } else if (!PageUptodate(page) && copied == PAGE_CACHE_SIZE)
> > > -               SetPageUptodate(page);
> > > +       }
> > >
> > >        if (!PageUptodate(page)) {
> > >                char *page_data;
> > 
> > Jeff and I just talked about his patch above, and decided not to make
> > his minor change above.  Moving PageUptodate check earlier would
> > complicate things in one way ... if PageChecked were ever set at the
> > same time as PageUptodate then PageChecked would stay set.  That is
> > probably not an issue but that is clearer with the original.
> > 
> 
> I think it actually is a problem. Suppose PageChecked is never cleared
> like you say, we flush the page and then do a partial page write again.
> We do a readpage this time and it fails, but the copy of data to the
> page works. Now we hit cifs_write_end and PageChecked is set, but
> the unwritten parts of the page actually aren't up to date. Data
> corruption ensues...
> 
> I agree that we should drop that patch. We might be able to make
> cifs_write_end more efficient, but we'll need to be more careful
> with PageChecked.

Oh? I admittedly haven't looked at the source code after applying
your latest patch, but I thought it should not be possible to have
a leaking PageChecked. The page is under the page lock the whole
time, so a concurrent write should not be an issue...?


  reply	other threads:[~2008-12-01  8:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081121105613.09a8cb8e@tleilax.poochiereds.net>
     [not found] ` <524f69650811210820s549de2bah3181cbc0c5633091@mail.gmail.com>
     [not found]   ` <20081121112249.0b408b55@tleilax.poochiereds.net>
     [not found]     ` <524f69650811210846q7502fd99m6f4d335bb6ac1b65@mail.gmail.com>
     [not found]       ` <524f69650811211109w659e5decoa34a8e0f907772a3@mail.gmail.com>
     [not found]         ` <524f69650811211113q4fffcc70of88cb85db531c358@mail.gmail.com>
     [not found]           ` <1227296476.20845.8.camel@norville.austin.ibm.com>
     [not found]             ` <524f69650811211218v78295682lcf6dce842327b097@mail.gmail.com>
2008-11-21 20:38               ` Fwd: fsx-linux failing with latest cifs-2.6 git tree Steve French
2008-11-21 20:41                 ` Dave Kleikamp
2008-11-21 21:02                   ` Steve French
2008-11-21 23:44                   ` Nick Piggin
2008-11-21 20:50                 ` Jeff Layton
2008-11-21 22:50                 ` Jeff Layton
2008-11-21 23:02                   ` Dave Kleikamp
2008-11-21 23:25                     ` Jeff Layton
2008-11-22  1:04                       ` Steve French
2008-11-22  1:50                         ` Jeff Layton
2008-11-21 23:53                   ` Nick Piggin
2008-11-22  1:51                     ` Jeff Layton
2008-11-22  2:02                       ` Steve French
2008-11-22  4:47                         ` Dave Kleikamp
2008-11-22 15:39                           ` [linux-cifs-client] " Jeff Layton
2008-11-22 20:27                             ` Dave Kleikamp
2008-11-23 11:57                               ` Jeff Layton
2008-11-24  2:32                                 ` Steve French
2008-11-24 11:19                                   ` [linux-cifs-client] " Jeff Layton
2008-11-26  4:04                                     ` Steve French
2008-11-26 11:54                                       ` Jeff Layton
2008-11-26 12:11                                       ` Jeff Layton
2008-11-26 13:09                                         ` [linux-cifs-client] " Nick Piggin
2008-11-26 15:08                                           ` Jeff Layton
2008-11-26 15:23                                             ` Nick Piggin
2008-11-26 16:37                                               ` Jeff Layton
2008-11-27  8:33                                                 ` Nick Piggin
2008-11-28 12:18                                                   ` Jeff Layton
2008-11-30 21:44                                                     ` Steve French
2008-11-30 22:17                                                       ` Jeff Layton
2008-12-01  8:44                                                         ` Nick Piggin [this message]
2008-12-01 11:28                                                           ` Jeff Layton
2008-12-01 11:32                                                             ` Nick Piggin
2008-12-01 11:55                                                               ` Jeff Layton
2008-12-01 17:43                                                                 ` Steve French
2008-11-26 19:46                                               ` Steve French
2008-11-24 20:00                                 ` Dave Kleikamp
2008-11-26 13:02                       ` Nick Piggin

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=20081201084435.GE2529@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=jlayton@redhat.com \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    --cc=smfrench@gmail.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;
as well as URLs for NNTP newsgroup(s).