lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1198903859.6353.7.camel@norville.austin.ibm.com>
Date:	Fri, 28 Dec 2007 22:50:59 -0600
From:	Dave Kleikamp <shaggy@...ux.vnet.ibm.com>
To:	Fengguang Wu <wfg@...l.ustc.edu.cn>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	jfs-discussion@...ts.sourceforge.net,
	Nick Piggin <nickpiggin@...oo.com.au>
Subject: Re: [PATCH] jfs: clear PAGECACHE_TAG_DIRTY for no-write pages


On Sat, 2007-12-29 at 10:21 +0800, Fengguang Wu wrote:
> On Fri, Dec 28, 2007 at 10:53:14AM -0600, Dave Kleikamp wrote:
> 
> 
> > ---
> > 
> > diff -Nurp linux-2.6.24-rc6-git5/fs/jfs/jfs_metapage.c linux/fs/jfs/jfs_metapage.c
> > --- linux-2.6.24-rc6-git5/fs/jfs/jfs_metapage.c	2007-12-28 10:28:33.000000000 -0600
> > +++ linux/fs/jfs/jfs_metapage.c	2007-12-28 10:37:30.000000000 -0600
> > @@ -360,6 +360,7 @@ static int metapage_writepage(struct pag
> >  	struct metapage *mp;
> >  	int redirty = 0;
> >  	sector_t lblock;
> > +	int nr_underway = 0;
> >  	sector_t pblock;
> >  	sector_t next_block = 0;
> >  	sector_t page_start;
> > @@ -371,6 +372,7 @@ static int metapage_writepage(struct pag
> >  		     (PAGE_CACHE_SHIFT - inode->i_blkbits);
> >  	BUG_ON(!PageLocked(page));
> >  	BUG_ON(PageWriteback(page));
> 
> This line should be moved below:
> > +	set_page_writeback(page);

No.  set_page_writeback() needs to be called before submit_bio() is
called.

I don't think there is any harm in calling set_page_writeback(),
redirty_page_for_writeback() and end_page_writeback() in the case where
there is no I/O to submit, and some dirty data cannot be written.  It is
consistent with what happens in __block_write_full_page().

It's also possible that some part of the page was written, and another
part cannot be, causing the page to be redirtied.

> >  
> >  	for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
> >  		mp = page_to_mp(page, offset);
> > @@ -413,11 +415,10 @@ static int metapage_writepage(struct pag
> >  			if (!bio->bi_size)
> >  				goto dump_bio;
> >  			submit_bio(WRITE, bio);
> > +			nr_underway++;
> >  			bio = NULL;
> > -		} else {
> > -			set_page_writeback(page);
> > +		} else
> >  			inc_io(page);
> > -		}
> >  		xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
> >  		pblock = metapage_get_blocks(inode, lblock, &xlen);
> >  		if (!pblock) {
> > @@ -449,12 +450,16 @@ static int metapage_writepage(struct pag
> >  			goto dump_bio;
> >  
> >  		submit_bio(WRITE, bio);
> > +		nr_underway++;
> >  	}
> >  	if (redirty)
> >  		redirty_page_for_writepage(wbc, page);
> +       else
> +               set_page_writeback(page);
> >  
> >  	unlock_page(page);
> >  
> > +	if (nr_underway == 0)
>   +     if (nr_underway == 0 && redirty == 0)
> 
> > +		end_page_writeback(page);
> > +
> >  	return 0;
> >  add_failed:
> >  	/* We should never reach here, since we're only adding one vec */
> 
> Otherwise looks pretty good.
> 
> Reviewed-by: Fengguang Wu <wfg@...l.ustc.edu.cn>
> 
-- 
David Kleikamp
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ