kernel_optimize_test/fs
Roland Dreier e91f90bb0b aio: wake all waiters when destroying ctx
The test program below will hang because io_getevents() uses
add_wait_queue_exclusive(), which means the wake_up() in io_destroy() only
wakes up one of the threads.  Fix this by using wake_up_all() in the aio
code paths where we want to make sure no one gets stuck.

	// t.c -- compile with gcc -lpthread -laio t.c

	#include <libaio.h>
	#include <pthread.h>
	#include <stdio.h>
	#include <unistd.h>

	static const int nthr = 2;

	void *getev(void *ctx)
	{
		struct io_event ev;
		io_getevents(ctx, 1, 1, &ev, NULL);
		printf("io_getevents returned\n");
		return NULL;
	}

	int main(int argc, char *argv[])
	{
		io_context_t ctx = 0;
		pthread_t thread[nthr];
		int i;

		io_setup(1024, &ctx);

		for (i = 0; i < nthr; ++i)
			pthread_create(&thread[i], NULL, getev, ctx);

		sleep(1);

		io_destroy(ctx);

		for (i = 0; i < nthr; ++i)
			pthread_join(thread[i], NULL);

		return 0;
	}

Signed-off-by: Roland Dreier <roland@purestorage.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-22 17:44:17 -07:00
..
9p 9p: use the updated offset given by generic_write_checks 2011-03-22 16:32:49 -05:00
adfs adfs: add hexadecimal filetype suffix option 2011-03-22 17:44:17 -07:00
affs fs: change to new flag variable 2011-03-17 14:02:57 +01:00
afs
autofs4 lose 'mounting_here' argument in ->d_manage() 2011-03-18 10:01:59 -04:00
befs
bfs bfs: fix bitmap size argument to find_first_zero_bit() 2011-03-21 08:35:12 -04:00
btrfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-03-18 10:37:40 -07:00
cachefiles
ceph ceph: rename dentry_release -> d_release, fix comment 2011-03-21 12:24:26 -07:00
cifs
coda codafs: fix compile warning when CONFIG_SYSCTL=n 2011-03-22 17:44:16 -07:00
configfs
cramfs
debugfs
devpts fs: devpts_pty_new() return -ENOMEM if dentry allocation failed 2011-03-21 00:59:24 -04:00
dlm
ecryptfs
efs
exofs
exportfs
ext2
ext3 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6 2011-03-17 17:41:19 -07:00
ext4 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-03-18 10:37:40 -07:00
fat
freevxfs
fscache
fuse mm: add replace_page_cache_page() function 2011-03-22 17:44:02 -07:00
gfs2 Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-03-20 18:14:55 -07:00
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs mm: hugetlbfs: change remove_from_page_cache 2011-03-22 17:44:02 -07:00
isofs
jbd
jbd2
jffs2
jfs Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-03-20 18:14:55 -07:00
lockd
logfs
minix
ncpfs fs: change to new flag variable 2011-03-17 14:02:57 +01:00
nfs nfs: lock() vs unlock() typo 2011-03-21 00:45:50 -04:00
nfs_common
nfsd don't pass 'mounting_here' flag to follow_down() 2011-03-18 09:04:20 -04:00
nilfs2
nls
notify
ntfs fs: change to new flag variable 2011-03-17 14:02:57 +01:00
ocfs2 Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-03-20 18:14:55 -07:00
omfs
openpromfs
partitions Increase OSF partition limit from 8 to 18 2011-03-16 08:04:07 -07:00
proc smaps: have smaps show transparent huge pages 2011-03-22 17:44:04 -07:00
pstore pstore: use mount option instead sysfs to tweak kmsg_bytes 2011-03-21 13:50:05 -07:00
qnx4
quota
ramfs
reiserfs Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-03-20 18:14:55 -07:00
romfs
squashfs
sysfs
sysv
ubifs Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6 2011-03-18 10:50:27 -07:00
udf Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6 2011-03-17 17:29:38 -07:00
ufs Merge branch 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2011-03-16 17:21:00 -07:00
xfs Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs 2011-03-21 14:24:56 -07:00
aio.c aio: wake all waiters when destroying ctx 2011-03-22 17:44:17 -07:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c binfmt_elf: quiet GCC-4.6 'set but not used' warning in load_elf_binary() 2011-03-22 17:44:15 -07:00
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c fs: use appropriate printk priority levels 2011-03-22 17:44:10 -07:00
block_dev.c
buffer.c
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c
compat.c select: remove unused MAX_SELECT_SECONDS 2011-03-21 00:16:08 -04:00
dcache.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2011-03-18 10:51:11 -07:00
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c epoll: fix compiler warning and optimize the non-blocking path 2011-03-22 17:44:15 -07:00
exec.c Small typo fix... 2011-03-21 00:16:09 -04:00
fcntl.c
fhandle.c
fifo.c Filesystem: fifo: Fixed coding style issue. 2011-03-21 00:16:09 -04:00
file_table.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2011-03-16 13:26:17 -07:00
file.c
filesystems.c
fs_struct.c
fs-writeback.c
generic_acl.c
inode.c fs/inode: Fix kernel-doc format for inode_init_owner 2011-03-21 00:16:08 -04:00
internal.h FS: lookup_mnt() is only used in the core fs routines now 2011-03-21 12:13:10 -04:00
ioctl.c vfs: cleanup do_vfs_ioctl() 2011-03-21 00:16:08 -04:00
ioprio.c
Kconfig Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2011-03-16 19:01:29 -07:00
Kconfig.binfmt
libfs.c
locks.c
Makefile Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2011-03-16 19:01:29 -07:00
mbcache.c
mpage.c
namei.c lose 'mounting_here' argument in ->d_manage() 2011-03-18 10:01:59 -04:00
namespace.c fs: use appropriate printk priority levels 2011-03-22 17:44:10 -07:00
nfsctl.c
no-block.c
open.c fs: Use BUG_ON(!mnt) at dentry_open(). 2011-03-21 01:10:41 -04:00
pipe.c
pnode.c
pnode.h
posix_acl.c
read_write.c
read_write.h
readdir.c
select.c select: remove unused MAX_SELECT_SECONDS 2011-03-21 00:16:08 -04:00
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c vfs: split off vfsmount-related parts of vfs_kern_mount() 2011-03-17 22:10:41 -04:00
sync.c introduce sys_syncfs to sync a single file system 2011-03-21 00:40:29 -04:00
timerfd.c
utimes.c
xattr_acl.c
xattr.c