From: Theodore Tso <tytso@mit.edu>
To: Curt Wohlgemuth <curtw@google.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: ext4: Can we talk about bforget() and metadata blocks
Date: Wed, 9 Sep 2009 21:35:40 -0400 [thread overview]
Message-ID: <20090910013540.GF24951@mit.edu> (raw)
In-Reply-To: <6601abe90909091707s1df9e71bvb4551772dc4917cb@mail.gmail.com>
On Wed, Sep 09, 2009 at 05:07:28PM -0700, Curt Wohlgemuth wrote:
>
> First, ext4_journal_forget() is called from ext4_forget() only when
> we're journalling; without a journal, ext4_journal_forget() is only
> called for various non-extent paths. ext4_forget() could be changed,
> of course...
Ext4_forget() calls either ext4_journal_forget() or
ext4_journal_revoke(). So we need to fix up both functions.
- Ted
commit 4afdf0958f6f7b878e6d85cb4e0c0c12a0bd74e2
Author: Theodore Ts'o <tytso@mit.edu>
Date: Wed Sep 9 21:32:41 2009 -0400
ext4: Use bforget() in no journal mode for ext4_journal_{forget,revoke}()
When ext4 is using a journal, a metadata block which is deallocated
must be passed into the journal layer so it can be dropped from the
current transaction and/or revoked. This is done by calling the
functions ext4_journal_forget() and ext4_journal_revoke(), which call
jbd2_journal_forget(), and jbd2_journal_revoke(), respectively.
Since the jbd2_journal_forget() and jbd2_journal_revoke() call
bforget(), if ext4 is not using a journal, ext4_journal_forget() and
ext4_journal_revoke() must call bforget() to avoid a dirty metadata
block overwriting a block after it has been reallocated and reused for
another inode's data block.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index eb27fd0..ecb9ca4 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -44,7 +44,7 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
handle, err);
}
else
- brelse(bh);
+ bforget(bh);
return err;
}
@@ -60,7 +60,7 @@ int __ext4_journal_revoke(const char *where, handle_t *handle,
handle, err);
}
else
- brelse(bh);
+ bforget(bh);
return err;
}
next parent reply other threads:[~2009-09-10 1:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6601abe90909091029s74465ebave932987e5fdf93ba@mail.gmail.com>
[not found] ` <20090909225429.GB24951@mit.edu>
[not found] ` <6601abe90909091707s1df9e71bvb4551772dc4917cb@mail.gmail.com>
2009-09-10 1:35 ` Theodore Tso [this message]
2009-09-10 6:54 ` ext4: Can we talk about bforget() and metadata blocks Aneesh Kumar K.V
2009-09-10 15:46 ` Curt Wohlgemuth
2009-09-10 16:24 ` Aneesh Kumar K.V
2009-09-10 18:58 ` Theodore Tso
2009-09-11 17:21 ` Aneesh Kumar K.V
2009-09-11 17:36 ` Curt Wohlgemuth
2009-09-11 18:08 ` Theodore Tso
2009-09-11 18:15 ` Theodore Tso
2009-09-12 15:00 ` Aneesh Kumar K.V
2009-09-12 17:59 ` Theodore Tso
2009-09-10 15:55 ` Curt Wohlgemuth
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=20090910013540.GF24951@mit.edu \
--to=tytso@mit.edu \
--cc=curtw@google.com \
--cc=linux-ext4@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).