public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: "Darrick J. Wong" <darrick.wong@oracle.com>,
	Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
	Hannes Reinecke <hare@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Did immutable bvecs accidentally break stable page writes? take 2
Date: Thu, 19 Sep 2013 11:14:18 +0100	[thread overview]
Message-ID: <20130919101418.GU22421@suse.de> (raw)

Apologies for the resend but Kent's email address changed. Hopefully this
one from last July is still valid.



Commit ffecfd1a (block: optionally snapshot page contents to provide
stable pages during write) uses bounce buffers for stable page writes in
jbd and ext3. Simplistically, __blk_queue_bounce takes a force parameter
that is used when pages must be snapshot.

Commit 6bc454d1 (bounce: Refactor __blk_queue_bounce to not use
bi_io_vec) refactored __blk_queue_bounce and now the start of the
function looks like this

static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
			       mempool_t *pool, int force)
{
	struct bio *bio;
	int rw = bio_data_dir(*bio_orig);
	struct bio_vec *to, *from;
	unsigned i;

	bio_for_each_segment(from, *bio_orig, i)
		if (page_to_pfn(from->bv_page) > queue_bounce_pfn(q))
			goto bounce;

	return;
bounce:
	bio = bio_clone_bioset(*bio_orig, GFP_NOIO, fs_bio_set);

	bio_for_each_segment_all(to, bio, i) {
		struct page *page = to->bv_page;

		if (page_to_pfn(page) <= queue_bounce_pfn(q) && !force)
			continue;

Note that the first bio_for_each_segment is completely ignoring the
force parameter and not snapshotting when requested. This would have been
problematic for ext3 until commit 71368511 ("mm: make snapshotting pages for
stable writes a per-bio operation) but the ignoring of the force parameter
is still suspicious.

Kent, why is it ok to ignore the force parameter even if the original bio
indicated that snapshotting was required in blk_queue_bounce?

-- 
Mel Gorman
SUSE Labs

                 reply	other threads:[~2013-09-19 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130919101418.GU22421@suse.de \
    --to=mgorman@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=hare@suse.de \
    --cc=jack@suse.cz \
    --cc=kmo@daterainc.com \
    --cc=linux-kernel@vger.kernel.org \
    /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