<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/aio.c, branch linux-2.6.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2007-02-24T00:24:25Z</updated>
<entry>
<title>aio: fix buggy put_ioctx call in aio_complete - v2</title>
<updated>2007-02-24T00:24:25Z</updated>
<author>
<name>Ken Chen</name>
</author>
<published>2007-02-03T09:13:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9e6551c77cc31225479c3f05b4e6b093d29762cb'/>
<id>urn:sha1:9e6551c77cc31225479c3f05b4e6b093d29762cb</id>
<content type='text'>
An AIO bug was reported that sleeping function is being called in softirq
context:

BUG: warning at kernel/mutex.c:132/__mutex_lock_common()
Call Trace:
     [&lt;a000000100577b00&gt;] __mutex_lock_slowpath+0x640/0x6c0
     [&lt;a000000100577ba0&gt;] mutex_lock+0x20/0x40
     [&lt;a0000001000a25b0&gt;] flush_workqueue+0xb0/0x1a0
     [&lt;a00000010018c0c0&gt;] __put_ioctx+0xc0/0x240
     [&lt;a00000010018d470&gt;] aio_complete+0x2f0/0x420
     [&lt;a00000010019cc80&gt;] finished_one_bio+0x200/0x2a0
     [&lt;a00000010019d1c0&gt;] dio_bio_complete+0x1c0/0x200
     [&lt;a00000010019d260&gt;] dio_bio_end_aio+0x60/0x80
     [&lt;a00000010014acd0&gt;] bio_endio+0x110/0x1c0
     [&lt;a0000001002770e0&gt;] __end_that_request_first+0x180/0xba0
     [&lt;a000000100277b90&gt;] end_that_request_chunk+0x30/0x60
     [&lt;a0000002073c0c70&gt;] scsi_end_request+0x50/0x300 [scsi_mod]
     [&lt;a0000002073c1240&gt;] scsi_io_completion+0x200/0x8a0 [scsi_mod]
     [&lt;a0000002074729b0&gt;] sd_rw_intr+0x330/0x860 [sd_mod]
     [&lt;a0000002073b3ac0&gt;] scsi_finish_command+0x100/0x1c0 [scsi_mod]
     [&lt;a0000002073c2910&gt;] scsi_softirq_done+0x230/0x300 [scsi_mod]
     [&lt;a000000100277d20&gt;] blk_done_softirq+0x160/0x1c0
     [&lt;a000000100083e00&gt;] __do_softirq+0x200/0x240
     [&lt;a000000100083eb0&gt;] do_softirq+0x70/0xc0

See report: http://marc.theaimsgroup.com/?l=linux-kernel&amp;m=116599593200888&amp;w=2

flush_workqueue() is not allowed to be called in the softirq context.
However, aio_complete() called from I/O interrupt can potentially call
put_ioctx with last ref count on ioctx and triggers bug.  It is simply
incorrect to perform ioctx freeing from aio_complete.

The bug is trigger-able from a race between io_destroy() and aio_complete().
A possible scenario:

cpu0                               cpu1
io_destroy                         aio_complete
  wait_for_all_aios {                __aio_put_req
     ...                                 ctx-&gt;reqs_active--;
     if (!ctx-&gt;reqs_active)
        return;
  }
  ...
  put_ioctx(ioctx)

                                     put_ioctx(ctx);
                                        __put_ioctx
                                          bam! Bug trigger!

The real problem is that the condition check of ctx-&gt;reqs_active in
wait_for_all_aios() is incorrect that access to reqs_active is not
being properly protected by spin lock.

This patch adds that protective spin lock, and at the same time removes
all duplicate ref counting for each kiocb as reqs_active is already used
as a ref count for each active ioctx.  This also ensures that buggy call
to flush_workqueue() in softirq context is eliminated.

Signed-off-by: "Ken Chen" &lt;kenchen@google.com&gt;
Cc: Zach Brown &lt;zach.brown@oracle.com&gt;
Cc: Suparna Bhattacharya &lt;suparna@in.ibm.com&gt;
Cc: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: Badari Pulavarty &lt;pbadari@us.ibm.com&gt;
Acked-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>[PATCH] pr_debug: aio: use size_t length modifier in pr_debug format arguments</title>
<updated>2006-10-03T15:04:19Z</updated>
<author>
<name>Zach Brown</name>
</author>
<published>2006-10-03T08:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=691578cd558e647dd89ae5bc74a2307bce821186'/>
<id>urn:sha1:691578cd558e647dd89ae5bc74a2307bce821186</id>
<content type='text'>
aio: use size_t length modifier in pr_debug format arguments

Signed-off-by: Zach Brown &lt;zach.brown@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] Add vector AIO support</title>
<updated>2006-10-01T07:39:29Z</updated>
<author>
<name>Badari Pulavarty</name>
</author>
<published>2006-10-01T06:28:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eed4e51fb60c3863c134a5e9f6006b29805ead97'/>
<id>urn:sha1:eed4e51fb60c3863c134a5e9f6006b29805ead97</id>
<content type='text'>
This work is initially done by Zach Brown to add support for vectored aio.
These are the core changes for AIO to support
IOCB_CMD_PREADV/IOCB_CMD_PWRITEV.

[akpm@osdl.org: huge build fix]
Signed-off-by: Zach Brown &lt;zach.brown@oracle.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Badari Pulavarty &lt;pbadari@us.ibm.com&gt;
Acked-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Acked-by: James Morris &lt;jmorris@namei.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] Vectorize aio_read/aio_write fileop methods</title>
<updated>2006-10-01T07:39:28Z</updated>
<author>
<name>Badari Pulavarty</name>
</author>
<published>2006-10-01T06:28:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=027445c37282bc1ed26add45e573ad2d3e4860a5'/>
<id>urn:sha1:027445c37282bc1ed26add45e573ad2d3e4860a5</id>
<content type='text'>
This patch vectorizes aio_read() and aio_write() methods to prepare for
collapsing all aio &amp; vectored operations into one interface - which is
aio_read()/aio_write().

Signed-off-by: Badari Pulavarty &lt;pbadari@us.ibm.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Michael Holzheu &lt;HOLZHEU@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>spelling fixes</title>
<updated>2006-06-26T16:35:02Z</updated>
<author>
<name>Andreas Mohr</name>
</author>
<published>2006-06-26T16:35:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6e05edc59ecd79e8badf440c0d295a979bdfa3e'/>
<id>urn:sha1:d6e05edc59ecd79e8badf440c0d295a979bdfa3e</id>
<content type='text'>
acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr &lt;andi@lisas.de&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>[PATCH] list: use list_replace_init() instead of list_splice_init()</title>
<updated>2006-06-23T14:43:07Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2006-06-23T09:05:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=626ab0e69d376fa07599af669af8ba92d58e87c1'/>
<id>urn:sha1:626ab0e69d376fa07599af669af8ba92d58e87c1</id>
<content type='text'>
list_splice_init(list, head) does unneeded job if it is known that
list_empty(head) == 1.  We can use list_replace_init() instead.

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] use kzalloc and kcalloc in core fs code</title>
<updated>2006-03-25T16:23:00Z</updated>
<author>
<name>Oliver Neukum</name>
</author>
<published>2006-03-25T11:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=11b0b5abb2097a63c1081d9b7e825b987b227972'/>
<id>urn:sha1:11b0b5abb2097a63c1081d9b7e825b987b227972</id>
<content type='text'>
Signed-off-by: Oliver Neukum &lt;oliver@neukum.name&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] rcu file: use atomic primitives</title>
<updated>2006-01-09T04:13:48Z</updated>
<author>
<name>Nick Piggin</name>
</author>
<published>2006-01-08T09:02:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=095975da26dba21698582e91e96be10f7417333f'/>
<id>urn:sha1:095975da26dba21698582e91e96be10f7417333f</id>
<content type='text'>
Use atomic_inc_not_zero for rcu files instead of special case rcuref.

Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: "Paul E. McKenney" &lt;paulmck@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] aio: replace locking comments with assert_spin_locked()</title>
<updated>2005-11-14T02:14:16Z</updated>
<author>
<name>Zach Brown</name>
</author>
<published>2005-11-14T00:07:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d00689af6b3b6ba9e1fdefec3bd62edc860c385d'/>
<id>urn:sha1:d00689af6b3b6ba9e1fdefec3bd62edc860c385d</id>
<content type='text'>
aio: replace locking comments with assert_spin_locked()

Signed-off-by: Zach Brown &lt;zach.brown@oracle.com&gt;
Acked-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] aio: remove kioctx from mm_struct</title>
<updated>2005-11-14T02:14:16Z</updated>
<author>
<name>Zach Brown</name>
</author>
<published>2005-11-14T00:07:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20dcae32439384b6863c626bb3b2a09bed65b33e'/>
<id>urn:sha1:20dcae32439384b6863c626bb3b2a09bed65b33e</id>
<content type='text'>
Sync iocbs have a life cycle that don't need a kioctx.  Their retrying, if
any, is done in the context of their owner who has allocated them on the
stack.

The sole user of a sync iocb's ctx reference was aio_complete() checking for
an elevated iocb ref count that could never happen.  No path which grabs an
iocb ref has access to sync iocbs.

If we were to implement sync iocb cancelation it would be done by the owner of
the iocb using its on-stack reference.

Removing this chunk from aio_complete allows us to remove the entire kioctx
instance from mm_struct, reducing its size by a third.  On a i386 testing box
the slab size went from 768 to 504 bytes and from 5 to 8 per page.

Signed-off-by: Zach Brown &lt;zach.brown@oracle.com&gt;
Acked-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
</feed>
