linux_dsm_epyc7002/fs
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
..
9p 9p: fix O_APPEND in legacy mode 2008-07-03 09:59:03 -05:00
adfs
affs
afs
autofs
autofs4
befs
bfs
cifs
coda
configfs
cramfs
debugfs
devpts
dlm
ecryptfs ecryptfs: remove unnecessary mux from ecryptfs_init_ecryptfs_miscdev() 2008-07-04 10:40:05 -07:00
efs
exportfs
ext2
ext3 ext3: add missing unlock to error path in ext3_quota_write() 2008-07-04 10:40:05 -07:00
ext4 ext4: add missing unlock to an error path in ext4_quota_write() 2008-07-04 10:40:05 -07:00
fat
freevxfs
fuse
gfs2 [GFS2] fix gfs2 block allocation (cleaned up) 2008-06-24 19:02:28 +01:00
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs
lockd
minix
msdos
ncpfs
nfs NFS: Fix readdir cache invalidation 2008-07-08 15:22:40 -04:00
nfs_common
nfsd
nls
ntfs
ocfs2 ocfs2: Fix flags in ocfs2_file_lock 2008-07-10 09:25:39 -07:00
openpromfs
partitions
proc Fix pagemap_read() use of struct mm_walk 2008-07-05 13:13:44 -07:00
qnx4
ramfs
reiserfs reiserfs: discard prealloc in reiserfs_delete_inode 2008-07-08 12:39:31 -07:00
romfs
smbfs
sysfs
sysv
udf
ufs
vfat
xfs Fix reference counting race on log buffers 2008-07-11 11:37:18 -07:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c
block_dev.c
buffer.c Properly notify block layer of sync writes 2008-07-01 09:07:34 +02:00
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c
compat.c
dcache.c
dcookies.c
direct-io.c
dnotify.c
dquot.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c exec: fix stack excutability without PT_GNU_STACK 2008-07-10 13:25:43 -07:00
fcntl.c
fifo.c
file_table.c
file.c
filesystems.c
fs-writeback.c
generic_acl.c
inode.c
inotify_user.c
inotify.c
internal.h
ioctl.c
ioprio.c
Kconfig ntfs: update help text 2008-07-04 10:40:07 -07:00
Kconfig.binfmt
libfs.c add kernel-doc for simple_read_from_buffer and memory_read_from_buffer 2008-07-04 10:40:07 -07:00
locks.c
Makefile
mbcache.c
mpage.c
namei.c
namespace.c
nfsctl.c
no-block.c
open.c security: filesystem capabilities: fix fragile setuid fixup code 2008-07-04 10:40:08 -07:00
pipe.c
pnode.c
pnode.h
posix_acl.c
quota_v1.c
quota_v2.c
quota.c
read_write.c
read_write.h
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
super.c
sync.c
timerfd.c
utimes.c
xattr_acl.c
xattr.c