From: Alex Tomas <alex@clusterfs.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Alex Tomas <alex@clusterfs.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
<ext2-devel@lists.sourceforge.net>, Andrew Morton <akpm@osdl.org>
Subject: Re: [Ext2-devel] [PATCH] JBD: journal_release_buffer()
Date: Tue, 25 Jan 2005 03:08:51 +0300 [thread overview]
Message-ID: <m3brbe9xpo.fsf@bzzz.home.net> (raw)
In-Reply-To: <1106609725.2103.616.camel@sisko.sctweedie.blueyonder.co.uk>
>>>>> Stephen C Tweedie (SCT) writes:
>> + /* return credit back to the handle if it was really spent */
>> + if (credits) {
>> + handle->h_buffer_credits++;
>> + spin_lock(&handle->h_transaction->t_handle_lock);
>> + handle->h_transaction->t_outstanding_credits++;
>> + spin_lock(&handle->h_transaction->t_handle_lock);
>> + }
SCT> That returns the credit to A (satisfying ext3), but you just grew
SCT> t_outstanding_credits, thus growing the journal commitments without
SCT> checking if it's safe to do so or being able to handle failure. So it
SCT> just reintroduces the original bug.
incremented h_buffer_credits will be subtracted from incremented
t_outstanding_credits in journal_stop(). so, there is no imbalance
at this point.
then, if (b_tcount == 0) we can correct t_outstanind_credits or
h_buffer_credits. wrong?
let's try another way ... we have two processes: P1 and P2. they
access block B.
the code is:
if (credits != 0) {
handle->h_buffer_credits++;
transaction->t_outstanding_credits++;
}
if (jh->b_tcount == 0)
transcation->t_outstanding_credits--;
case 1:
P1 accesses B (*credits=1)
P1 releases B
(credits != 0) h1->h_buffer_credits++;
(credits != 0) transaction->t_outstanding_credits++;
(b_tcount == 0) transaction->t_outstanding_credits--;
OUTPUT: transaction->t_outstanding_credits -= 1
case 2:
P1 accesses B (*credits=1)
P2 accesses B (*credits=0)
P1 releases B
P2 modifies B
(credits != 0) h1->h_buffer_credits++;
(credits != 0) transaction->t_outstainding_credits++;
(b_tcount != 0)
OUTPUT: journal_stop() will subtract incremented h_buffer_credits
from incremented t_outstading_credits => no changes
case 3:
P1 accesses B (*credits=1)
P2 accesses B (*credits=0)
P2 releases B
P1 modifies B
(credits != 0)
(credits != 0)
(b_tcount == 0)
OUTPUT: no changes
case 4:
P1 accesses B (*credits=1)
P2 accesses B (*credits=0)
P2 releases B
P1 releases B
(credits != 0)
(credits != 0)
(b_tcount == 0)
(credits != 0) h1->h_buffer_credits++;
(credits != 0) transaction->t_outstanding_credits++;
(b_tcount == 0) transaction->t_outstanding_credits--;
OUTPUT: P2 will change nothing, P1 will drop the buffer and
correct t_outstanding_credits
case 5:
P1 accesses B (*credits=1)
P2 accesses B (*credits=0)
P1 releases B
P2 releases B
(credits != 0) h1->h_buffer_credits++;
(credits != 0) transaction->t_outstanding_credits++;
(b_tcount == 0)
(credits != 0)
(credits != 0)
(b_tcount == 0) transaction->t_outstanding_credits--;
OUTPUT: P1 will change own credits, P2 will drop the buffer
and correct t_outstanding_credits
thanks, Alex
next prev parent reply other threads:[~2005-01-25 0:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-19 15:32 Alex Tomas
2005-01-24 22:05 ` [Ext2-devel] " Stephen C. Tweedie
2005-01-24 22:24 ` Alex Tomas
2005-01-24 23:35 ` Stephen C. Tweedie
2005-01-25 0:08 ` Alex Tomas [this message]
2005-01-25 14:36 ` Alex Tomas
2005-01-25 16:21 ` Stephen C. Tweedie
2005-01-25 19:30 ` Alex Tomas
2005-01-26 17:12 ` Stephen C. Tweedie
2005-01-30 10:55 ` Alex Tomas
2005-02-04 23:45 ` Stephen C. Tweedie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3brbe9xpo.fsf@bzzz.home.net \
--to=alex@clusterfs.com \
--cc=akpm@osdl.org \
--cc=ext2-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®