]> git.hungrycats.org Git - linux/commit
[PATCH] loop: Fix OOM and oops
authorAndrew Morton <akpm@digeo.com>
Sun, 2 Mar 2003 12:36:44 +0000 (04:36 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Sun, 2 Mar 2003 12:36:44 +0000 (04:36 -0800)
commit29da03f1d5a0d4600187f1221c97cd02dc6e8d13
treef51daa14a515285222ce43c109d23adc3b8cc740
parent159b58552626a4adb581a81711d2649d6ca9208c
[PATCH] loop: Fix OOM and oops

The loop driver takes a copy of the data which it is writing.  When this
happens on the try_to_free_pages() path, loop can easily consume ALL memory
and bio_copy() will fail to allocate a page.

Loop forgets to check the bio_copy() return value and oopses.

Fix this by dropping PF_MEMALLOC and throttling to the block writeout speed.

The patch exports blk_congestion_wait() to modules for this.  This is a
needed export: several filesystems have a "try to allocate and yield if it
failed" loop and blk_congestion_wait() is a more appropriate way of
implementing the sleep in this situation.
drivers/block/loop.c
kernel/ksyms.c