History

aio: take final put_ioctx() into callers of io_destroy()

Al Viro committed 14 years ago

Commit a2e18591 parent 06af1211 file · +4 −6Browse files

Unified · Split

fs/aio.c+4−6
@@ -1270,7 +1270,6 @@ static void io_destroy(struct kioctx *ioctx) · 1269 unmodified lines
12701270 * locking done by the above calls to ensure this consistency.
12711271 */
12721272 wake_up_all(&ioctx->wait);
1273− put_ioctx(ioctx); /* once for the lookup */
12741273 }
12751274
12761275 /* sys_io_setup:
@@ -1307,11 +1306,9 @@ SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) · 30 unmodified lines
13071306 ret = PTR_ERR(ioctx);
13081307 if (!IS_ERR(ioctx)) {
13091308 ret = put_user(ioctx->user_id, ctxp);
1310− if (!ret) {
1311− put_ioctx(ioctx);
1312− return 0;
1313− }
1314− io_destroy(ioctx);
1309+ if (ret)
1310+ io_destroy(ioctx);
1311+ put_ioctx(ioctx);
13151312 }
13161313
13171314 out:
@@ -1329,6 +1326,7 @@ SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx) · 11 unmodified lines
13291326 struct kioctx *ioctx = lookup_ioctx(ctx);
13301327 if (likely(NULL != ioctx)) {
13311328 io_destroy(ioctx);
1329+ put_ioctx(ioctx);
13321330 return 0;
13331331 }
13341332 pr_debug("EINVAL: io_destroy: invalid context id\n");