From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: kjournald() with DIO Date: Thu, 15 Sep 2005 14:20:54 -0700 Message-ID: <20050915142054.698c93fa.akpm@osdl.org> References: <20050912172935.19907edf.akpm@osdl.org> <1126630370.14837.60.camel@dyn9047017102.beaverton.ibm.com> <20050913160701.355cd46a.akpm@osdl.org> <1126718583.4010.6.camel@localhost.localdomain> <20050914111809.41c5b395.akpm@osdl.org> <1126734025.4010.21.camel@localhost.localdomain> <20050914150224.3b6d7051.akpm@osdl.org> <1126796604.14837.111.camel@dyn9047017102.beaverton.ibm.com> <20050915192225.GJ4122@opteron.random> <20050915130018.287270e4.akpm@osdl.org> <20050915202019.GK4122@opteron.random> <20050915133500.754a8b4d.akpm@osdl.org> <1126817371.14837.155.camel@dyn9047017102.beaverton.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: andrea@suse.de, cmm@us.ibm.com, linux-fsdevel@vger.kernel.org, sct@redhat.com Return-path: Received: from smtp.osdl.org ([65.172.181.4]:11924 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S1030543AbVIOVYx (ORCPT ); Thu, 15 Sep 2005 17:24:53 -0400 To: Badari Pulavarty In-Reply-To: <1126817371.14837.155.camel@dyn9047017102.beaverton.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Badari Pulavarty wrote: > > Here is the race: > > > DIO Process kjounald() > journal_commit_transaction() > ... > /* submited buffers for IO */ > /* Waiting for IO to complete */ > while (t_locked_list) { > ... > get_bh(bh); > if (buffer_locked(bh)) { > spin_unlock(&journal->j_list_lock); > wait_on_buffer(bh); > > > invalidate_complete_page() > .. > ext3_releasepage() > journal_try_to_free_buffers() > journal_put_journal_head() > __journal_try_to_free_buffer() > <--- freed jh > > try_to_free_buffers() > drop_buffers() > if (buffer_busy(bh)) > goto failed; > <<--- returns EIO due to b_count Right. But there's still a race in there. invalidate_complete_page() may still fail for these buffers. The only blocking it does is lock_buffer(). So if kjournald does: get_bh(bh); wait_on_bffer(bh); <- window put_bh(bh); ext3_invalidatepage() may hit that unlocked, pinned buffer and fail to release the page. In that case, truncate_complete_page() will convert the apge into an anonymous page (if it's mmapped). If it's just a pagecache page then I guess it'll be converted into a zero-ref page on the page LRU. It's not possible for ext3_invalidatepage() to block until a buffer comes unpinned. We'd have to add additional stuff for that. (bring back wake_up_buffer(), for example).