public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Did immutable bvecs accidentally break stable page writes?
@ 2013-09-19  9:32 Mel Gorman
  2013-09-19  9:40 ` Mel Gorman
  0 siblings, 1 reply; 4+ messages in thread
From: Mel Gorman @ 2013-09-19  9:32 UTC (permalink / raw)
  To: Darrick J. Wong, Kent Overstreet
  Cc: Jens Axboe, Jan Kara, Andrew Morton, linux-kernel

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 hence snapshotting. This is particularly problematic
for ext3 which forces the use of MS_SNAP_STABLE.

I have not actually reproduced any problem, this is just code inspection
but it looks like commit 6bc454d1 broke ext3. Kent, why was the force
paramter ignored in that commit?

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Did immutable bvecs accidentally break stable page writes?
  2013-09-19  9:32 Did immutable bvecs accidentally break stable page writes? Mel Gorman
@ 2013-09-19  9:40 ` Mel Gorman
  2013-09-19 14:22   ` Jan Kara
  2013-09-20  2:38   ` Darrick J. Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Mel Gorman @ 2013-09-19  9:40 UTC (permalink / raw)
  To: Darrick J. Wong, Kent Overstreet
  Cc: Jens Axboe, Jan Kara, Andrew Morton, linux-kernel

On Thu, Sep 19, 2013 at 10:32:50AM +0100, Mel Gorman wrote:
> 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 hence snapshotting. This is particularly problematic
> for ext3 which forces the use of MS_SNAP_STABLE.
> 

Which of course is no longer a problem for ext3 after commit 71368511
("mm: make snapshotting pages for stable writes a per-bio operation). The
folly of looking at a commit in isolation! I'm still curious why the force
parameter is ignored when stable writes are required though.

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Did immutable bvecs accidentally break stable page writes?
  2013-09-19  9:40 ` Mel Gorman
@ 2013-09-19 14:22   ` Jan Kara
  2013-09-20  2:38   ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2013-09-19 14:22 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Darrick J. Wong, Kent Overstreet, Jens Axboe, Jan Kara,
	Andrew Morton, linux-kernel

On Thu 19-09-13 10:40:30, Mel Gorman wrote:
> On Thu, Sep 19, 2013 at 10:32:50AM +0100, Mel Gorman wrote:
> > 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 hence snapshotting. This is particularly problematic
> > for ext3 which forces the use of MS_SNAP_STABLE.
> > 
> 
> Which of course is no longer a problem for ext3 after commit 71368511
> ("mm: make snapshotting pages for stable writes a per-bio operation). The
> folly of looking at a commit in isolation! I'm still curious why the force
> parameter is ignored when stable writes are required though.
  This really looks like a bug to me. Since stable pages are currently
required only for drives supporting DIF/DIX noone has likely noticed. But
still we should fix that.

								Honza

PS: As an unrelated note first 8 digits of the commit SHA are not unique
for that commit. Time to switch to longer prefixes? :)
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Did immutable bvecs accidentally break stable page writes?
  2013-09-19  9:40 ` Mel Gorman
  2013-09-19 14:22   ` Jan Kara
@ 2013-09-20  2:38   ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2013-09-20  2:38 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Kent Overstreet, Jens Axboe, Jan Kara, Andrew Morton,
	linux-kernel

On Thu, Sep 19, 2013 at 10:40:30AM +0100, Mel Gorman wrote:
> On Thu, Sep 19, 2013 at 10:32:50AM +0100, Mel Gorman wrote:
> > 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 hence snapshotting. This is particularly problematic
> > for ext3 which forces the use of MS_SNAP_STABLE.
> > 
> 
> Which of course is no longer a problem for ext3 after commit 71368511
> ("mm: make snapshotting pages for stable writes a per-bio operation). The
> folly of looking at a commit in isolation! I'm still curious why the force
> parameter is ignored when stable writes are required though.

I'm confused by this (second) statement.  Mel, I think you were arguing that
this is broken because BIO_SNAP_STABLE sets force=1, yet __blk_queue_bounce()
ignores "force", which leads to the pages not being bounced.

So it /is/ a likely regression, and testing confirms that DIF+ext3 is broken.
I believe that there should be a "if(force) goto bounce;" just after the
variable declarations.  I'll go write a patch and check though.

--D
> 
> -- 
> Mel Gorman
> SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-22 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19  9:32 Did immutable bvecs accidentally break stable page writes? Mel Gorman
2013-09-19  9:40 ` Mel Gorman
2013-09-19 14:22   ` Jan Kara
2013-09-20  2:38   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox