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: <20110519213119.GA19782@localhost>
Date:	Fri, 20 May 2011 05:31:19 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Dave Chinner <david@...morbit.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, Jan Kara <jack@...e.cz>,
	Christoph Hellwig <hch@...radead.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 02/17] writeback: update dirtied_when for synced inode
 to prevent livelock

> > > @@ -419,6 +419,15 @@ writeback_single_inode(struct inode *ino
> > >  	spin_lock(&inode->i_lock);
> > >  	inode->i_state &= ~I_SYNC;
> > >  	if (!(inode->i_state & I_FREEING)) {
> > > +		/*
> > > +		 * Sync livelock prevention. Each inode is tagged and synced in
> > > +		 * one shot, so we can unconditionally update its dirty time to
> > > +		 * prevent syncing it again. Note that time ordering of b_dirty
> > > +		 * list will be kept because the following code either removes
> > > +		 * the inode from b_dirty or calls redirty_tail().
> > > +		 */
> > > +		if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_sync)
> > > +			inode->dirtied_when = jiffies;
> > 
> > Shouldn't this  update only ocur if the inode is still dirty?
> 
> Yeah, that would be better even though the current form won't lead to
> errors.
> 
> Let's add one more test (inode->i_state & I_DIRTY)?
> (I was actually aware of the trade offs and didn't bother to add it..)

Oops, the (inode->i_state & I_DIRTY) test is not enough because
when the inode is actively dirtied, I_DIRTY_PAGES won't be set when
the flusher is writing out the pages with I_SYNC set...

Well it would look clumsy to add another mapping_tagged(mapping,
PAGECACHE_TAG_DIRTY) test. So I tend to revert to the original scheme
of updating ->dirtied_when only on newly dirtied pages. It's the
simplest form that can avoid unnecessarily polluting ->dirtied_when.

@@ -432,6 +432,15 @@ writeback_single_inode(struct inode *ino
 				requeue_io(inode);
 			} else {
 				/*
+				 * Sync livelock prevention. Each inode is
+				 * tagged and synced in one shot, so we can
+				 * unconditionally update its dirty time to
+				 * prevent syncing it again.
+				 */
+				if (wbc->sync_mode == WB_SYNC_ALL ||
+				    wbc->tagged_writepages)
+					inode->dirtied_when = jiffies;
+				/*
 				 * Writeback blocked by something other than
 				 * congestion. Delay the inode for some time to
 				 * avoid spinning on the CPU (100% iowait)

Thanks,
Fengguang
--
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