From: Younger Liu <younger.liu@huawei.com> To: Andrew Morton <akpm@linux-foundation.org>, "Theodore Ts'o" <tytso@mit.edu> Cc: <linux-ext4@vger.kernel.org>, Ocfs2-Devel <ocfs2-devel@oss.oracle.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>, Li Zefan <lizefan@huawei.com> Subject: [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart() Date: Wed, 19 Jun 2013 12:48:26 +0800 [thread overview] Message-ID: <51C1381A.2@huawei.com> (raw) jbd2_journal_restart() would restart a handle. In this function, it calls start_this_handle(). Before calling start_this_handle(),subtract 1 from transaction->t_updates. If start_this_handle() succeeds, transaction->t_updates increases by 1 in it. But if start_this_handle() fails, transaction->t_updates does not increase. So, when commit the handle's transaction in jbd2_journal_stop(), the assertion is false, and then trigger a bug. The assertion is as follows: J_ASSERT(atomic_read(&transaction->t_updates) > 0) Signed-off-by: Younger Liu <younger.liu@huawei.com> --- fs/jbd2/transaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 325bc01..9ddb444 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -530,6 +530,8 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) lock_map_release(&handle->h_lockdep_map); handle->h_buffer_credits = nblocks; ret = start_this_handle(journal, handle, gfp_mask); + if (ret < 0) + atomic_inc(&transaction->t_updates); return ret; } EXPORT_SYMBOL(jbd2__journal_restart); -- 1.7.9.7
WARNING: multiple messages have this Message-ID (diff)
From: Younger Liu <younger.liu@huawei.com> To: Andrew Morton <akpm@linux-foundation.org>, Theodore Ts'o <tytso@mit.edu> Cc: linux-ext4@vger.kernel.org, Ocfs2-Devel <ocfs2-devel@oss.oracle.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>, Li Zefan <lizefan@huawei.com> Subject: [Ocfs2-devel] [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart() Date: Wed, 19 Jun 2013 12:48:26 +0800 [thread overview] Message-ID: <51C1381A.2@huawei.com> (raw) jbd2_journal_restart() would restart a handle. In this function, it calls start_this_handle(). Before calling start_this_handle()?subtract 1 from transaction->t_updates. If start_this_handle() succeeds, transaction->t_updates increases by 1 in it. But if start_this_handle() fails, transaction->t_updates does not increase. So, when commit the handle's transaction in jbd2_journal_stop(), the assertion is false, and then trigger a bug. The assertion is as follows: J_ASSERT(atomic_read(&transaction->t_updates) > 0) Signed-off-by: Younger Liu <younger.liu@huawei.com> --- fs/jbd2/transaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 325bc01..9ddb444 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -530,6 +530,8 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) lock_map_release(&handle->h_lockdep_map); handle->h_buffer_credits = nblocks; ret = start_this_handle(journal, handle, gfp_mask); + if (ret < 0) + atomic_inc(&transaction->t_updates); return ret; } EXPORT_SYMBOL(jbd2__journal_restart); -- 1.7.9.7
next reply other threads:[~2013-06-19 4:48 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-19 4:48 Younger Liu [this message] 2013-06-19 4:48 ` [Ocfs2-devel] [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart() Younger Liu 2013-06-20 15:55 ` Theodore Ts'o 2013-06-20 15:55 ` [Ocfs2-devel] " Theodore Ts'o 2013-06-20 15:55 ` Theodore Ts'o 2013-06-20 16:08 ` [PATCH] jbd2: fix theoretical race in jbd2__journal_restart Theodore Ts'o 2013-06-20 16:08 ` [Ocfs2-devel] " Theodore Ts'o 2013-06-20 17:26 ` [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart() Josef Bacik 2013-06-20 17:26 ` [Ocfs2-devel] " Josef Bacik 2013-06-20 18:12 ` Theodore Ts'o 2013-06-20 18:12 ` [Ocfs2-devel] " Theodore Ts'o 2013-06-21 23:26 ` Jan Kara 2013-06-21 23:26 ` [Ocfs2-devel] " Jan Kara 2013-06-21 13:29 ` Younger Liu 2013-06-21 13:29 ` [Ocfs2-devel] " Younger Liu 2013-06-23 17:36 ` Theodore Ts'o 2013-06-23 17:36 ` [Ocfs2-devel] " Theodore Ts'o 2013-06-23 17:44 ` [PATCH] jbd2: invalidate handle if jbd2_journal_restart() fails Theodore Ts'o 2013-06-24 9:53 ` Jan Kara 2013-06-25 9:42 ` Younger Liu 2013-06-29 23:46 ` Theodore Ts'o 2013-07-03 12:22 ` Younger Liu 2013-07-03 12:36 ` Younger Liu 2013-06-25 8:30 ` [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart() Younger Liu 2013-06-25 8:30 ` [Ocfs2-devel] " Younger Liu 2013-06-29 13:22 ` Joel Becker 2013-06-29 13:22 ` [Ocfs2-devel] " Joel Becker
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=51C1381A.2@huawei.com \ --to=younger.liu@huawei.com \ --cc=akpm@linux-foundation.org \ --cc=linux-ext4@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lizefan@huawei.com \ --cc=ocfs2-devel@oss.oracle.com \ --cc=tytso@mit.edu \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.