author: Jens Axboe <axboe@kernel.dk> 2020-10-30 09:36:41 -0600
committer: Jens Axboe <axboe@kernel.dk> 2020-11-04 10:22:56 -0700
commit: 3dd1680d1418f22f7ddaf98a4eab66285a099b3e
parent: 3cea11cd5e3b00d91caf0b4730194039b45c5891
Commit Summary:
Diffstat:
1 file changed, 4 insertions, 0 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c
index 02894df7656d..b53c055bea6a 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -482,6 +482,10 @@ static void io_impersonate_work(struct io_worker *worker,
current->files = work->identity->files;
current->nsproxy = work->identity->nsproxy;
task_unlock(current);
+ if (!work->identity->files) {
+ /* failed grabbing files, ensure work gets cancelled */
+ work->flags |= IO_WQ_WORK_CANCEL;
+ }
}
if ((work->flags & IO_WQ_WORK_FS) && current->fs != work->identity->fs)
current->fs = work->identity->fs;