From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?SsO2cm4=?= Engel Subject: Re: Race between __sync_single_inode() and LogFS garbage collector Date: Tue, 20 Feb 2007 10:50:22 +0000 Message-ID: <20070220105022.GB10455@lazybastard.org> References: <20070219213150.GD7813@lazybastard.org> <1171926356.9771.34.camel@kleikamp.austin.ibm.com> <20070219232351.GG7813@lazybastard.org> <1171940793.7963.10.camel@kleikamp.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org To: Dave Kleikamp Return-path: Received: from lazybastard.de ([212.112.238.170]:34363 "EHLO longford.lazybastard.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932863AbXBTKyW (ORCPT ); Tue, 20 Feb 2007 05:54:22 -0500 Content-Disposition: inline In-Reply-To: <1171940793.7963.10.camel@kleikamp.austin.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, 19 February 2007 21:06:33 -0600, Dave Kleikamp wrote: >=20 > You've obviously given this a lot more thought that I have, but this > sounds like something that has possibilities. You couldn't implement > your own drop_inode method that does better locking against the garba= ge > collector? Bloody hell! What a great question for an unexpected reason. GC also races against iput(). Basically whenever anyone locks any inode, I may have a problem. If that inode remains locked until some writeout happens, I will have a problem. Afaics, locking happens in three places: __sync_single_inode() Causes writeout of inode pages and inode itself iput() Causes writeout of inode itself get_new_inode() or get_new_inode_fast() No writes from here Both __sync_single_inode() and iput() would need to prevent GC before locking the inode. GC can be caused by any writes to LogFS, so they need to lock against all write paths in LogFS. Once they start writeou= t themselves, they also need to pass information that they have taken the lock onward, otherwise taking the lock itself would deadlock. Nasty. Alternatively there could be a non-blocking version of iget() that simply returns when an inode is locked. Now GC would have to spin in a loop, waiting for one of two possible events. Either the inode is getting unlocked or someone calls into LogFS with the inode in question and GC needs to take that by some means. Again, nasty. The more I think about it, the more I like the idea of double-caching inodes. As ugly as it sounds, it causes the least amount of problems. Thanks, Shaggy! J=C3=B6rn --=20 Linux [...] existed just for discussion between people who wanted to show off how geeky they were. -- Rob Enderle - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html