]> git.baikalelectronics.ru Git - kernel.git/commit
GFS2: Test bufdata with buffer locked and gfs2_log_lock held
authorBenjamin Marzinski <bmarzins@redhat.com>
Wed, 7 Nov 2012 06:38:06 +0000 (00:38 -0600)
committerSteven Whitehouse <swhiteho@redhat.com>
Wed, 7 Nov 2012 09:43:03 +0000 (09:43 +0000)
commitd9df2189e7726e1a1ce6baa3eac6b333b26c88a2
treeca5a7f4cf7508bc287af7b35b1d75e71d11f765b
parent7e338eda754b025925e637784233bb5c5d3548a6
GFS2: Test bufdata with buffer locked and gfs2_log_lock held

In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
buffer without having the gfs2_log_lock held. It was then assuming it would
stay attached for the rest of the function. However, without either the log
lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
time.  This patch moves the locking before the test.  If there isn't a bd
already attached, gfs2 can safely allocate one and attach it before locking.
There is no way that the newly allocated bd could be on the ail list,
and thus no way for __gfs2_ail_flush() to detach it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/lops.c
fs/gfs2/trans.c