From 524e63d2931ea85a81c29d6cebea700cdbb311d7 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 29 Dec 2003 05:52:15 -0800 Subject: [PATCH] [PATCH] JBD: b_committed_data locking fix The locking rules say that b_committed_data is covered by jbd_lock_bh_state(), so implement that during the start of commit, while throwing away unused shadow buffers. I don't expect that there is really a race here, but them's the rules. --- fs/jbd/commit.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 78aaded6d2d9e..77365a09254ed 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c @@ -177,8 +177,14 @@ void journal_commit_transaction(journal_t *journal) * leave undo-committed data. */ if (jh->b_committed_data) { - kfree(jh->b_committed_data); - jh->b_committed_data = NULL; + struct buffer_head *bh = jh2bh(jh); + + jbd_lock_bh_state(bh); + if (jh->b_committed_data) { + kfree(jh->b_committed_data); + jh->b_committed_data = NULL; + } + jbd_unlock_bh_state(bh); } journal_refile_buffer(journal, jh); } -- 2.53.0