]> git.kernelconcepts.de Git - karo-tx-linux.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)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 6 Dec 2012 11:20:17 +0000 (11:20 +0000)
commit23da2a1f5e79c95dbae9c88848b57e39af80b326
tree66bc78a2a2d0e74d021eb54ff70ac3af8510759d
parent9ca6025acefa787bf57ac748fbd987fd79e2d259
GFS2: Test bufdata with buffer locked and gfs2_log_lock held

commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.

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>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/gfs2/lops.c
fs/gfs2/trans.c