From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 3/6] fs: sync_sb_inodes fix Date: Thu, 11 Dec 2008 13:51:47 -0800 Message-ID: <20081211135147.59d50e96.akpm@linux-foundation.org> References: <20081210072454.GB27096@wotan.suse.de> <20081210072707.GD27096@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, mpatocka@redhat.com To: Nick Piggin Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:38447 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757498AbYLKVwG (ORCPT ); Thu, 11 Dec 2008 16:52:06 -0500 In-Reply-To: <20081210072707.GD27096@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 10 Dec 2008 08:27:07 +0100 Nick Piggin wrote: > + if (sync) { > + struct inode *inode, *old_inode = NULL; > + > + /* > + * Data integrity sync. Must wait for all pages under writeback, > + * because there may have been pages dirtied before our sync > + * call, but which had writeout started before we write it out. > + * In which case, the inode may not be on the dirty list, but > + * we still have to wait for that writeout. > + */ > + list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { > + struct address_space *mapping; > + > + if (inode->i_state & (I_FREEING|I_WILL_FREE)) > + continue; > + mapping = inode->i_mapping; > + if (mapping->nrpages == 0) > + continue; > + __iget(inode); > + spin_unlock(&inode_lock); > + /* > + * We hold a reference to 'inode' so it couldn't have > + * been removed from s_inodes list while we dropped the > + * inode_lock. We cannot iput the inode now as we can > + * be holding the last reference and we cannot iput it > + * under inode_lock. So we keep the reference and iput > + * it later. > + */ hm, tricky. Can umount run concurrently with this? What will it say about the busy inode? > + iput(old_inode); > + old_inode = inode; > + > + filemap_fdatawait(mapping); > + > + cond_resched(); > + > + spin_lock(&inode_lock); > + } > + spin_unlock(&inode_lock); > + iput(old_inode); > + } else