]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iomap: always run error completions in user context
authorChristoph Hellwig <hch@lst.de>
Thu, 13 Nov 2025 17:06:27 +0000 (18:06 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 25 Nov 2025 09:22:18 +0000 (10:22 +0100)
At least zonefs expects error completions to be able to sleep.  Because
error completions aren't performance critical, just defer them to workqueue
context unconditionally.

Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20251113170633.1453259-3-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/direct-io.c

index 7659db85083afa05040c248548dcf3a99b659f92..765ab6dd66374fd1aaa8c74523f5997486fda9f5 100644 (file)
@@ -173,7 +173,18 @@ static void iomap_dio_done(struct iomap_dio *dio)
 
                WRITE_ONCE(dio->submit.waiter, NULL);
                blk_wake_io_task(waiter);
-       } else if (dio->flags & IOMAP_DIO_INLINE_COMP) {
+               return;
+       }
+
+       /*
+        * Always run error completions in user context.  These are not
+        * performance critical and some code relies on taking sleeping locks
+        * for error handling.
+        */
+       if (dio->error)
+               dio->flags &= ~IOMAP_DIO_INLINE_COMP;
+
+       if (dio->flags & IOMAP_DIO_INLINE_COMP) {
                WRITE_ONCE(iocb->private, NULL);
                iomap_dio_complete_work(&dio->aio.work);
        } else {