Commit e0bbb346 authored by Jens Axboe's avatar Jens Axboe
Browse files

io-wq: cancel work if we fail getting a mm reference



If we require mm and user context, mark the request for cancellation
if we fail to acquire the desired mm.

Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 74566df3
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -445,10 +445,14 @@ next:
			task_unlock(current);
		}
		if ((work->flags & IO_WQ_WORK_NEEDS_USER) && !worker->mm &&
		    wq->mm && mmget_not_zero(wq->mm)) {
		    wq->mm) {
			if (mmget_not_zero(wq->mm)) {
				use_mm(wq->mm);
				set_fs(USER_DS);
				worker->mm = wq->mm;
			} else {
				work->flags |= IO_WQ_WORK_CANCEL;
			}
		}
		if (!worker->creds)
			worker->creds = override_creds(wq->creds);