Commit b3c6e774 authored by Joseph Qi's avatar Joseph Qi Committed by Luis Henriques

ocfs2: fix BUG in ocfs2_downconvert_thread_do_work()

commit 209f7512 upstream.

The "BUG_ON(list_empty(&osb->blocked_lock_list))" in
ocfs2_downconvert_thread_do_work can be triggered in the following case:

ocfs2dc has firstly saved osb->blocked_lock_count to local varibale
processed, and then processes the dentry lockres.  During the dentry
put, it calls iput and then deletes rw, inode and open lockres from
blocked list in ocfs2_mark_lockres_freeing.  And this causes the
variable `processed' to not reflect the number of blocked lockres to be
processed, which triggers the BUG.
Signed-off-by: default avatarJoseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 1e10a0a1
...@@ -4006,9 +4006,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) ...@@ -4006,9 +4006,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
osb->dc_work_sequence = osb->dc_wake_sequence; osb->dc_work_sequence = osb->dc_wake_sequence;
processed = osb->blocked_lock_count; processed = osb->blocked_lock_count;
while (processed) { /*
BUG_ON(list_empty(&osb->blocked_lock_list)); * blocked lock processing in this loop might call iput which can
* remove items off osb->blocked_lock_list. Downconvert up to
* 'processed' number of locks, but stop short if we had some
* removed in ocfs2_mark_lockres_freeing when downconverting.
*/
while (processed && !list_empty(&osb->blocked_lock_list)) {
lockres = list_entry(osb->blocked_lock_list.next, lockres = list_entry(osb->blocked_lock_list.next,
struct ocfs2_lock_res, l_blocked_list); struct ocfs2_lock_res, l_blocked_list);
list_del_init(&lockres->l_blocked_list); list_del_init(&lockres->l_blocked_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment