From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 2/2] writeback: Replace some redirty_tail() calls with requeue_io() Date: Thu, 8 Sep 2011 09:22:36 +0800 Message-ID: <20110908012236.GB12712@localhost> References: <1315442684-26754-1-git-send-email-jack@suse.cz> <1315442684-26754-2-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Dave Chinner , Christoph Hellwig To: Jan Kara Return-path: Received: from mga14.intel.com ([143.182.124.37]:9059 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757718Ab1IHBWj (ORCPT ); Wed, 7 Sep 2011 21:22:39 -0400 Content-Disposition: inline In-Reply-To: <1315442684-26754-2-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Jan, > @@ -420,6 +421,8 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, > /* Don't write the inode if only I_DIRTY_PAGES was set */ > if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { > int err = write_inode(inode, wbc); > + if (!err) > + inode_written = true; > if (ret == 0) > ret = err; > } write_inode() typically return error after redirtying the inode. So the conditions inode_written=false and (inode->i_state & I_DIRTY) are mostly on/off together. For the cases they disagree, it's probably a filesystem bug -- at least I don't think some FS will deliberately return success while redirtying the inode, or the reverse. > } else if (inode->i_state & I_DIRTY) { > /* > * Filesystems can dirty the inode during writeback > * operations, such as delayed allocation during > * submission or metadata updates after data IO > - * completion. > + * completion. Also inode could have been dirtied by > + * some process aggressively touching metadata. > + * Finally, filesystem could just fail to write the > + * inode for some reason. We have to distinguish the > + * last case from the previous ones - in the last case > + * we want to give the inode quick retry, in the > + * other cases we want to put it back to the dirty list > + * to avoid livelocking of writeback. > */ > - redirty_tail(inode, wb); > + if (inode_written) > + redirty_tail(inode, wb); Can you elaborate the livelock in the below inode_written=true case? Why the sleep in the wb_writeback() loop is not enough? > + else > + requeue_io(inode, wb); > } else { > /* > * The inode is clean. At this point we either have Thanks, Fengguang