From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [Bug 18632] "INFO: task" dpkg "blocked for more than 120 seconds. Date: Mon, 20 Jun 2011 00:33:51 +0800 Message-ID: <20110619163351.GA24763@localhost> References: <20110609035426.GA12061@localhost> <20110609082718.GA10335@infradead.org> <20110609090906.GA19186@localhost> <20110609110214.GA9017@infradead.org> <20110609121117.GA5768@localhost> <20110609121742.GA29569@infradead.org> <20110609124315.GA8789@localhost> <20110609132357.GA9928@infradead.org> <20110610032149.GA7114@localhost> <20110619155646.GA6648@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Carlos Alberto Lopez Perez , Dave Chinner , Andrew Morton , Jan Kara , "linux-fsdevel@vger.kernel.org" , "bugzilla-daemon@bugzilla.kernel.org" , "daaugusto@gmail.com" , "kernel-bugzilla@cygnusx-1.org" , "listposter@gmail.com" , "justincase@yopmail.com" , Tao Ma , Jens Axboe , Vivek Goyal To: Christoph Hellwig Return-path: Received: from mga11.intel.com ([192.55.52.93]:47235 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564Ab1FSQdz (ORCPT ); Sun, 19 Jun 2011 12:33:55 -0400 Content-Disposition: inline In-Reply-To: <20110619155646.GA6648@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Jun 19, 2011 at 11:56:46PM +0800, Christoph Hellwig wrote: > On Fri, Jun 10, 2011 at 11:21:49AM +0800, Wu Fengguang wrote: > > > Can you check if that helps with your livelock test case? (And yes, I > > > should go and try it myself. Will do as soon as I'll get a bit more > > > time). > > > > My pleasure. It's easier to compare results on the same test bed and > > I've made it very convenient to test patches :) > > Here's one that should be even better, although in it's current form it > break a subtile corner case of sync semantics, so it'll need more work > if I go down that way: The sync(1)s are much faster now, in most invocations it's in the same level as ext4 :) root@fat /home/wfg# ./sync-livelock.sh sync time: 3 sync time: 5 sync time: 5 sync time: 6 sync time: 15 sync time: 5 sync time: 5 sync time: 5 sync time: 4 sync time: 10 sync time: 4 sync time: 4 Thanks, Fengguang > Index: xfs/fs/xfs/linux-2.6/xfs_sync.c > =================================================================== > --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c 2011-06-17 14:16:18.442399481 +0200 > +++ xfs/fs/xfs/linux-2.6/xfs_sync.c 2011-06-18 17:55:44.864025123 +0200 > @@ -359,14 +359,16 @@ xfs_quiesce_data( > { > int error, error2 = 0; > > - /* push non-blocking */ > - xfs_sync_data(mp, 0); > xfs_qm_sync(mp, SYNC_TRYLOCK); > - > - /* push and block till complete */ > - xfs_sync_data(mp, SYNC_WAIT); > xfs_qm_sync(mp, SYNC_WAIT); > > + /* flush all pending size updates and unwritten extent conversions */ > + flush_workqueue(xfsconvertd_workqueue); > + flush_workqueue(xfsdatad_workqueue); > + > + /* force out the newly dirtied log buffers */ > + xfs_log_force(mp, XFS_LOG_SYNC); > + > /* write superblock and hoover up shutdown errors */ > error = xfs_sync_fsdata(mp); > > Index: xfs/fs/xfs/linux-2.6/xfs_super.c > =================================================================== > --- xfs.orig/fs/xfs/linux-2.6/xfs_super.c 2011-06-18 17:51:05.660705925 +0200 > +++ xfs/fs/xfs/linux-2.6/xfs_super.c 2011-06-18 17:52:50.107367305 +0200 > @@ -929,45 +929,12 @@ xfs_fs_write_inode( > * ->sync_fs call do that for thus, which reduces the number > * of synchronous log foces dramatically. > */ > - xfs_ioend_wait(ip); > xfs_ilock(ip, XFS_ILOCK_SHARED); > - if (ip->i_update_core) { > + if (ip->i_update_core) > error = xfs_log_inode(ip); > - if (error) > - goto out_unlock; > - } > - } else { > - /* > - * We make this non-blocking if the inode is contended, return > - * EAGAIN to indicate to the caller that they did not succeed. > - * This prevents the flush path from blocking on inodes inside > - * another operation right now, they get caught later by > - * xfs_sync. > - */ > - if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) > - goto out; > - > - if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) > - goto out_unlock; > - > - /* > - * Now we have the flush lock and the inode is not pinned, we > - * can check if the inode is really clean as we know that > - * there are no pending transaction completions, it is not > - * waiting on the delayed write queue and there is no IO in > - * progress. > - */ > - if (xfs_inode_clean(ip)) { > - xfs_ifunlock(ip); > - error = 0; > - goto out_unlock; > - } > - error = xfs_iflush(ip, SYNC_TRYLOCK); > + xfs_iunlock(ip, XFS_ILOCK_SHARED); > } > > - out_unlock: > - xfs_iunlock(ip, XFS_ILOCK_SHARED); > - out: > /* > * if we failed to write out the inode then mark > * it dirty again so we'll try again later.