linux/fs/xfs
Dave Chinner 49641f1acf 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>
2008-07-11 11:37:18 -07:00
..
linux-2.6 [XFS] Fix memory corruption with small buffer reads 2008-05-23 18:12:49 +10:00
quota [XFS] shrink mrlock_t 2008-04-29 15:54:02 +10:00
support [XFS] Include linux/random.h in all builds, not just debug builds. 2008-04-30 18:17:44 +10:00
Kconfig [XFS] allow enabling CONFIG_XFS_DEBUG 2008-04-29 16:07:48 +10:00
Makefile
xfs.h [XFS] Fix broken HAVE_SPLICE removal commit. 2008-04-29 15:57:49 +10:00
xfs_acl.c [XFS] Cleanup xfs_attr a bit with xfs_name and remove cred 2008-04-29 15:54:55 +10:00
xfs_acl.h
xfs_ag.h
xfs_alloc.c [XFS] fix logic error in xfs_alloc_ag_vextent_near() 2008-04-18 12:03:02 +10:00
xfs_alloc.h
xfs_alloc_btree.c
xfs_alloc_btree.h
xfs_arch.h
xfs_attr.c [XFS] Cleanup xfs_attr a bit with xfs_name and remove cred 2008-04-29 15:54:55 +10:00
xfs_attr.h [XFS] Cleanup xfs_attr a bit with xfs_name and remove cred 2008-04-29 15:54:55 +10:00
xfs_attr_leaf.c [XFS] Always use di_forkoff when checking for attr space. 2008-04-18 12:03:40 +10:00
xfs_attr_leaf.h
xfs_attr_sf.h
xfs_bit.c
xfs_bit.h
xfs_bmap.c [XFS] shrink mrlock_t 2008-04-29 15:54:02 +10:00
xfs_bmap.h
xfs_bmap_btree.c
xfs_bmap_btree.h
xfs_btree.c
xfs_btree.h
xfs_buf_item.c [XFS] Ensure xfs_bawrite() errors are checked. 2008-04-18 12:00:35 +10:00
xfs_buf_item.h
xfs_clnt.h
xfs_da_btree.c
xfs_da_btree.h
xfs_dfrag.c [XFS] remove manual lookup from xfs_rename and simplify locking 2008-04-29 15:54:12 +10:00
xfs_dfrag.h
xfs_dinode.h
xfs_dir2.c [XFS] remove bhv_vname_t and xfs_rename code 2008-04-18 12:00:12 +10:00
xfs_dir2.h [XFS] remove bhv_vname_t and xfs_rename code 2008-04-18 12:00:12 +10:00
xfs_dir2_block.c
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c
xfs_dir2_leaf.h
xfs_dir2_node.c
xfs_dir2_node.h
xfs_dir2_sf.c
xfs_dir2_sf.h
xfs_dir2_trace.c
xfs_dir2_trace.h
xfs_dmapi.h
xfs_dmops.c
xfs_error.c
xfs_error.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_filestream.c
xfs_filestream.h
xfs_fs.h
xfs_fsops.c [XFS] Don't double count reserved block changes on UP. 2008-04-29 15:58:27 +10:00
xfs_fsops.h
xfs_ialloc.c [XFS] Don't initialise new inode generation numbers to zero 2008-04-29 15:58:56 +10:00
xfs_ialloc.h
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_iget.c [XFS] shrink mrlock_t 2008-04-29 15:54:02 +10:00
xfs_imap.h
xfs_inode.c [XFS] Fix inode list allocation size in writeback. 2008-05-23 15:26:15 +10:00
xfs_inode.h [XFS] remove manual lookup from xfs_rename and simplify locking 2008-04-29 15:54:12 +10:00
xfs_inode_item.c [XFS] shrink mrlock_t 2008-04-29 15:54:02 +10:00
xfs_inode_item.h
xfs_inum.h
xfs_iomap.c [XFS] Fix check for block zero access in xfs_write_iomap_allocate() 2008-04-29 15:58:40 +10:00
xfs_iomap.h
xfs_itable.c [XFS] kill di_mode checks after xfs_iget 2008-04-29 15:53:31 +10:00
xfs_itable.h
xfs_log.c Fix reference counting race on log buffers 2008-07-11 11:37:18 -07:00
xfs_log.h [XFS] Sanitise xfs_log_force error checking. 2008-04-18 12:02:20 +10:00
xfs_log_priv.h
xfs_log_recover.c [XFS] Check for errors when changing buffer pointers. 2008-04-18 12:02:10 +10:00
xfs_log_recover.h
xfs_mount.c [XFS] kill XFS_ICSB_SB_LOCKED 2008-04-29 15:57:38 +10:00
xfs_mount.h [XFS] fix non-smp xfs build 2008-04-29 15:58:00 +10:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_qmops.c
xfs_quota.h
xfs_refcache.h
xfs_rename.c [XFS] kill usesless IHOLD calls in xfs_rename 2008-04-29 15:54:24 +10:00
xfs_rtalloc.c [XFS] Propagate errors from xfs_trans_commit(). 2008-04-18 11:58:17 +10:00
xfs_rtalloc.h
xfs_rw.c [XFS] Sanitise xfs_log_force error checking. 2008-04-18 12:02:20 +10:00
xfs_rw.h
xfs_sb.h
xfs_trans.c
xfs_trans.h
xfs_trans_ail.c
xfs_trans_buf.c [XFS] Ensure errors from xfs_bdstrat() are correctly checked. 2008-04-18 12:00:24 +10:00
xfs_trans_extfree.c
xfs_trans_inode.c [XFS] shrink mrlock_t 2008-04-29 15:54:02 +10:00
xfs_trans_item.c
xfs_trans_priv.h
xfs_trans_space.h
xfs_types.h [XFS] remove bhv_vname_t and xfs_rename code 2008-04-18 12:00:12 +10:00
xfs_utils.c [XFS] remove manual lookup from xfs_rename and simplify locking 2008-04-29 15:54:12 +10:00
xfs_utils.h [XFS] remove manual lookup from xfs_rename and simplify locking 2008-04-29 15:54:12 +10:00
xfs_vfsops.c [XFS] remove xfs_log_ticket_zone on rmmod 2008-04-29 15:58:14 +10:00
xfs_vfsops.h
xfs_vnodeops.c [XFS] Fix fsync() b0rkage. 2008-05-23 15:25:25 +10:00
xfs_vnodeops.h [XFS] Fix fsync() b0rkage. 2008-05-23 15:25:25 +10:00