lkml.org 
[lkml]   [2005]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Fix list scanning in __cleanup_transaction
  Hello,

attached patch fixes a bug in list scanning that can cause we skip the
last buffer on the checkpoint list (and hence fail to do any progress
under some rather unfavorable conditions). The problem is we first do
jh=next_jh and then test } while (jh!=last_jh); . Hence we skip the last
buffer on the list (if it was not the only buffer on the list). As we
already do jh=next_jh; in the beginning of the loop we are safe to just
remove the assignment in the end. It can happen that 'jh' will be freed
at the point we test jh != last_jh but that does not matter as we never
*dereference* the pointer. Please apply.

Honza

--
Jan Kara <jack@suse.cz>
SuSE CR Labs
We already move to the next member of the list in the beginning of the loop.
When we move in the end of the loop we can unintentionally forget to scan
the last buffer of the list.

Signed-off-by: Jan Kara <jack@suse.cz>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc5-1-checkretry/fs/jbd/checkpoint.c linux-2.6.12-rc5-2-checkskip/fs/jbd/checkpoint.c
--- linux-2.6.12-rc5-1-checkretry/fs/jbd/checkpoint.c 2005-05-27 11:15:31.000000000 +0200
+++ linux-2.6.12-rc5-2-checkskip/fs/jbd/checkpoint.c 2005-05-27 11:18:08.000000000 +0200
@@ -188,7 +188,6 @@ static int __cleanup_transaction(journal
} else {
jbd_unlock_bh_state(bh);
}
- jh = next_jh;
} while (jh != last_jh);

return ret;
\
 
 \ /
  Last update: 2005-06-01 09:55    [W:0.021 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site