diff options
author | Dave Chinner <david@fromorbit.com> | 2008-07-11 17:43:55 +1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-11 11:37:18 -0700 |
commit | 49641f1acfdfd437ed9b0a70b86bf36626c02afe (patch) | |
tree | 628838591b71f80d96c548d1a145b8d086c33c2a /fs/no-block.c | |
parent | 61ca9daa2ca3022dc9cb22bd98e69c1b61e412ad (diff) |
Fix reference counting race on log buffers
When we release the iclog, we do an atomic_dec_and_lock to determine if
we are the last reference and need to trigger update of log headers and
writeout. However, in xlog_state_get_iclog_space() we also need to
check if we have the last reference count there. If we do, we release
the log buffer, otherwise we decrement the reference count.
But the compare and decrement in xlog_state_get_iclog_space() is not
atomic, so both places can see a reference count of 2 and neither will
release the iclog. That leads to a filesystem hang.
Close the race by replacing the atomic_read() and atomic_dec() pair with
atomic_add_unless() to ensure that they are executed atomically.
Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Tim Shimmin <tes@sgi.com>
Tested-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/no-block.c')
0 files changed, 0 insertions, 0 deletions