From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/2] xfs: xfs_check_page_type buffer checks need help
Date: Thu, 6 Mar 2014 10:18:07 +1100 [thread overview]
Message-ID: <20140305231807.GJ6851@dastard> (raw)
In-Reply-To: <20140305220819.GC55736@bfoster.bfoster>
On Wed, Mar 05, 2014 at 05:08:20PM -0500, Brian Foster wrote:
> On Wed, Mar 05, 2014 at 12:11:32PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > xfs_aops_discard_page() was introduced in the following commit:
> >
> > xfs: truncate delalloc extents when IO fails in writeback
> >
> > ... to clean up left over delalloc ranges after I/O failure in
> > ->writepage(). generic/224 tests for this scenario and occasionally
> > reproduces panics on sub-4k blocksize filesystems.
> >
> > The cause of this is failure to clean up the delalloc range on a
> > page where the first buffer does not match one of the expected
> > states of xfs_check_page_type(). If a buffer is not unwritten,
> > delayed or dirty&mapped, xfs_check_page_type() stops and
> > immediately returns 0.
....
> > @@ -777,6 +795,7 @@ xfs_convert_page(
> > count++;
> > } else {
> > done = 1;
> > + break;
> > }
> > } while (offset += len, (bh = bh->b_this_page) != head);
> >
>
> The next couple lines after the loop are:
>
> if (uptodate && bh == head)
> SetPageUptodate(page);
>
> Now that we can break out of the loop, the "bh == head" part of that
> check might not necessarily mean what it used to mean. The uptodate
> variable is initialized to 1 and we reset to 0 the moment we encounter a
> !uptodate buffer. Do you think it's possible to get here on the first
> buffer of the page, without having reset 'uptodate,' and potentially
> incorrectly set the page uptodate?
Good question :)
I don't think this can happen because if the first buffer on the
page can't be written, xfs_check_page_type() will return false and
we won't get to the loop. By definition, buffer_unwritten() implies
buffer_uptodate(), as does buffer_delay() and buffer_dirty(). Hence
any of the types that will return acceptible will have the first
buffer uptodate.
As for the other breaks in the loop - the initial imap_valid check
ensures we have a map that covers the entire region of the page that
needs writing, and we know that offset < end_offset for the first
buffer on the page. Hence none of the loop breaks will trigger on
the first buffer, and so the above code should not trigger.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-03-05 23:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 1:11 [PATCH 0/2] xfs: more bug fixes Dave Chinner
2014-03-05 1:11 ` [PATCH 1/2] xfs: xfs_check_page_type buffer checks need help Dave Chinner
2014-03-05 17:06 ` Christoph Hellwig
2014-03-05 22:08 ` Brian Foster
2014-03-05 23:18 ` Dave Chinner [this message]
2014-03-05 1:11 ` [PATCH 2/2] xfs: inode log reservations are still too small Dave Chinner
2014-03-05 3:33 ` Eric Sandeen
2014-03-05 16:06 ` Brian Foster
2014-03-05 17:14 ` Christoph Hellwig
2014-03-05 21:40 ` Dave Chinner
2014-03-05 22:34 ` Christoph Hellwig
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=20140305231807.GJ6851@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.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