summaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@kvack.org>2013-07-31 10:34:18 -0400
committerBenjamin LaHaise <bcrl@kvack.org>2013-07-31 10:34:18 -0400
commit6878ea72a5d1aa6caae86449975a50b7fe9abed5 (patch)
tree9750b6a7f37d340227399ff282a6aefb6892cd98 /fs/aio.c
parentdb446a08c23d5475e6b08c87acca79ebb20f283c (diff)
downloadblackbird-op-linux-6878ea72a5d1aa6caae86449975a50b7fe9abed5.tar.gz
blackbird-op-linux-6878ea72a5d1aa6caae86449975a50b7fe9abed5.zip
aio: be defensive to ensure request batching is non-zero instead of BUG_ON()
In the event that an overflow/underflow occurs while calculating req_batch, clamp the minimum at 1 request instead of doing a BUG_ON(). Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 52f200ebef07..588aff9dc316 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -576,7 +576,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
atomic_set(&ctx->reqs_available, ctx->nr_events - 1);
ctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4);
- BUG_ON(!ctx->req_batch);
+ if (ctx->req_batch < 1)
+ ctx->req_batch = 1;
err = ioctx_add_table(ctx, mm);
if (err)
OpenPOWER on IntegriCloud