Commit 40ea9a64 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Use __GFP_REPEAT for cdrom buffer

The cdrom driver does an order-4 allocation and the open will fail if that
allocation does not succeed.  This happened to me on an unstressed 900MB
machine.

So add the __GFP_REPEAT flag in there - this will cause the page allocator to
keep on freeing pages until the allocation succeeds.

It can in theory livelock but in practice I expect it is OK: the user should
just stop running dbench or whatever it is which is gobbling all the memory
and the mount/open will then succeed.
parent 4d1ba80c
......@@ -3343,7 +3343,8 @@ static int idecd_open(struct inode * inode, struct file * file)
drive->usage++;
if (!info->buffer)
info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
info->buffer = kmalloc(SECTOR_BUFFER_SIZE,
GFP_KERNEL|__GFP_REPEAT);
if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file)))
drive->usage--;
return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment