From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [Bug 18632] "INFO: task" dpkg "blocked for more than 120 seconds. Date: Thu, 9 Jun 2011 09:23:57 -0400 Message-ID: <20110609132357.GA9928@infradead.org> References: <201106082138.p58Lchgj002615@demeter2.kernel.org> <20110608150241.8412a63d.akpm@linux-foundation.org> <20110609033217.GA10741@localhost> <20110609035426.GA12061@localhost> <20110609082718.GA10335@infradead.org> <20110609090906.GA19186@localhost> <20110609110214.GA9017@infradead.org> <20110609121117.GA5768@localhost> <20110609121742.GA29569@infradead.org> <20110609124315.GA8789@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , 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: Wu Fengguang Return-path: Received: from 173-166-109-252-newengland.hfc.comcastbusiness.net ([173.166.109.252]:33344 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757555Ab1FINYa (ORCPT ); Thu, 9 Jun 2011 09:24:30 -0400 Content-Disposition: inline In-Reply-To: <20110609124315.GA8789@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Here is a patch that removes the XFS-internal writing of data in sync and instead trusts the VFS code to get it right, and also does the ioend_wait under a lock, to protect against new pending I/Os showing up. It passed a single xfsqa run so far, so at least it won't blow up completely. 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). Index: xfs/fs/xfs/linux-2.6/xfs_super.c =================================================================== --- xfs.orig/fs/xfs/linux-2.6/xfs_super.c 2011-06-09 14:17:06.952532698 +0200 +++ xfs/fs/xfs/linux-2.6/xfs_super.c 2011-06-09 14:17:36.742531190 +0200 @@ -991,7 +991,7 @@ 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_ioend_wait(ip); xfs_ilock(ip, XFS_ILOCK_SHARED); if (ip->i_update_core) { error = xfs_log_inode(ip); Index: xfs/fs/xfs/linux-2.6/xfs_sync.c =================================================================== --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c 2011-06-09 14:16:59.575866405 +0200 +++ xfs/fs/xfs/linux-2.6/xfs_sync.c 2011-06-09 14:22:31.675849591 +0200 @@ -215,6 +215,19 @@ xfs_inode_ag_iterator( } STATIC int +xfs_wait_ioend_cb( + struct xfs_inode *ip, + struct xfs_perag *pag, + int flags) +{ + xfs_ilock(ip, XFS_IOLOCK_SHARED); + xfs_ioend_wait(ip); + xfs_iunlock(ip, XFS_IOLOCK_SHARED); + + return 0; +} + +STATIC int xfs_sync_inode_data( struct xfs_inode *ip, struct xfs_perag *pag, @@ -359,14 +372,14 @@ 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); + error = xfs_inode_ag_iterator(mp, xfs_wait_ioend_cb, 0); + if (error) + return XFS_ERROR(error); + + xfs_log_force(mp, XFS_LOG_SYNC); + /* write superblock and hoover up shutdown errors */ error = xfs_sync_fsdata(mp);