android_kernel_xiaomi_sm8350/fs
Chen, Kenneth W 174e27c607 [PATCH] direct-io: bug fix in dio handling write error
There is a bug in direct-io on propagating write error up to the higher I/O
layer.  When performing an async ODIRECT write to a block device, if a
device error occurred (like media error or disk is pulled), the error code
is only propagated from device driver to the DIO layer.  The error code
stops at finished_one_bio().  The aysnc write, however, is supposedly have
a corresponding AIO event with appropriate return code (in this case -EIO).
 Application which waits on the async write event, will hang forever since
such AIO event is lost forever (if such app did not use the timeout option
in io_getevents call.  Regardless, an AIO event is lost).

The discovery of above bug leads to another discovery of potential race
window with dio->result.  The fundamental problem is that dio->result is
overloaded with dual use: an indicator of fall back path for partial dio
write, and an error indicator used in the I/O completion path.  In the
event of device error, the setting of -EIO to dio->result clashes with
value used to track partial write that activates the fall back path.

It was also pointed out that it is impossible to use dio->result to track
partial write and at the same time to track error returned from device
driver.  Because direct_io_work can only determines whether it is a partial
write at the end of io submission and in mid stream of those io submission,
a return code could be coming back from the driver.  Thus messing up all
the subsequent logic.

Proposed fix is to separating out error code returned by the IO completion
path from partial IO submit tracking.  A new variable is added to dio
structure specifically to track io error returned in the completion path.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Acked-by: Zach Brown <zach.brown@oracle.com>
Acked-by: Suparna Bhattacharya <suparna@in.ibm.com>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-25 08:23:00 -08:00
..
9p [PATCH] 9p: fix name consistency problems 2006-03-25 08:22:54 -08:00
adfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
affs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
afs [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
autofs
autofs4 [PATCH] sem2mutex: autofs4 wq_sem 2006-03-23 07:38:13 -08:00
befs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
bfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
cifs [PATCH] s/;;/;/g 2006-03-24 07:33:24 -08:00
coda [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
configfs
cramfs
debugfs [PATCH] debugfs: Add debugfs_create_blob() helper for exporting binary data 2006-03-20 13:42:59 -08:00
devfs
devpts [PATCH] devpts: use lib/parser.c for parsing mount options 2006-03-23 07:38:17 -08:00
efs [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
exportfs
ext2 [PATCH] Ext2 flags shouldn't report "nogrpid" 2006-03-25 08:22:58 -08:00
ext3 [PATCH] ext3: Fix debug logging-only compilation error 2006-03-25 08:22:56 -08:00
fat [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
freevxfs [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
fuse
hfs
hfsplus
hostfs
hpfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
hppfs
hugetlbfs [PATCH] convert hugetlbfs_counter to atomic 2006-03-22 07:54:04 -08:00
isofs [PATCH] isofs: remove unused debugging macros 2006-03-24 07:33:24 -08:00
jbd [PATCH] jbd: convert kjournald to kthread API 2006-03-25 08:22:50 -08:00
jffs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
jffs2 [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
jfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
lockd [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
minix [PATCH] fix messages in fs/minix 2006-03-25 08:22:56 -08:00
msdos
ncpfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
nfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
nfs_common
nfsd [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
nls [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
ntfs [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
ocfs2 [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
openpromfs
partitions [PATCH] s390: Remove old history/whitespave from partition code 2006-03-24 07:33:17 -08:00
proc [PATCH] slab: implement /proc/slab_allocators 2006-03-25 08:22:49 -08:00
qnx4 [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
ramfs [PATCH] fs/*/file.c: drop insane header dependencies 2006-03-23 07:38:17 -08:00
reiserfs [PATCH] indirect_print_item() warning fix 2006-03-25 08:22:57 -08:00
romfs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
smbfs [PATCH] smbfs: Fix debug logging-only compilation error 2006-03-25 08:22:55 -08:00
sysfs [PATCH] sysfs: fix a kobject leak in sysfs_add_link on the error path 2006-03-20 13:42:59 -08:00
sysv [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
udf [PATCH] udf: fix uid/gid options and add uid/gid=ignore and forget options 2006-03-25 08:23:00 -08:00
ufs [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
vfat
xfs [PATCH] cpuset memory spread slab cache hooks 2006-03-24 07:33:23 -08:00
aio.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
block_dev.c [PATCH] sb_set_blocksize cleanup 2006-03-24 07:33:25 -08:00
buffer.c [PATCH] freeze_bdev() cleanup 2006-03-25 08:22:56 -08:00
char_dev.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
compat_ioctl.c [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
compat.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
dcache.c [PATCH] Reduce sched latency in shrink_dcache_sb() 2006-03-25 08:22:56 -08:00
dcookies.c
direct-io.c [PATCH] direct-io: bug fix in dio handling write error 2006-03-25 08:23:00 -08:00
dnotify.c
dquot.c [PATCH] cpuset memory spread: slab cache format 2006-03-24 07:33:23 -08:00
drop_caches.c
eventpoll.c [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
exec.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
fcntl.c [PATCH] Shrinks sizeof(files_struct) and better layout 2006-03-23 07:38:09 -08:00
fifo.c
file_table.c [PATCH] get_empty_filp tweaks, inline epoll_init_file() 2006-03-23 07:38:17 -08:00
file.c [PATCH] Shrinks sizeof(files_struct) and better layout 2006-03-23 07:38:09 -08:00
filesystems.c
fs-writeback.c [PATCH] Move cond_resched() after iput() in sync_sb_inodes() 2006-03-25 08:22:56 -08:00
inode.c [PATCH] fs/inode.c: make iprune_mutex static 2006-03-25 08:22:51 -08:00
inotify.c [PATCH] inotify: lock avoidance with parent watch status in dentry 2006-03-25 08:22:53 -08:00
ioctl.c
ioprio.c
Kconfig [PATCH] relay: migrate from relayfs to a generic relay API 2006-03-23 19:56:55 +01:00
Kconfig.binfmt
libfs.c [PATCH] sem2mutex: fs/libfs.c 2006-03-23 07:38:12 -08:00
locks.c
Makefile [PATCH] relay: migrate from relayfs to a generic relay API 2006-03-23 19:56:55 +01:00
mbcache.c [PATCH] cpuset memory spread: slab cache filesystems 2006-03-24 07:33:23 -08:00
mpage.c
namei.c [PATCH] Honour AOP_TRUNCATE_PAGE returns in page_symlink 2006-03-25 08:22:58 -08:00
namespace.c [PATCH] fs/namespace.c:dup_namespace(): fix a use after free 2006-03-15 09:37:34 -08:00
nfsctl.c [PATCH] fs: Use ARRAY_SIZE macro 2006-03-24 07:33:19 -08:00
open.c [PATCH] Add lookup_instantiate_filp usage warning 2006-03-25 08:22:51 -08:00
pipe.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
pnode.c [PATCH] s/;;/;/g 2006-03-24 07:33:24 -08:00
pnode.h
posix_acl.c
quota_v1.c
quota_v2.c [PATCH] sem2mutex: quota 2006-03-23 07:38:11 -08:00
quota.c [PATCH] sem2mutex: quota 2006-03-23 07:38:11 -08:00
read_write.c
readdir.c
select.c
seq_file.c [PATCH] sem2mutex: fs/seq_file.c 2006-03-23 07:38:12 -08:00
stat.c
super.c [PATCH] use kzalloc and kcalloc in core fs code 2006-03-25 08:23:00 -08:00
xattr_acl.c
xattr.c