summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-09 23:37:42 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:27 +0300
commit9552e19f6fff86d9907bb088f8b1eb786562f9d3 (patch)
treee9986f22d9b7d0d21f323d8a05264fe1f436e084 /fs/bcachefs/fs-io.c
parent4d126dc8b30c2c1c69cbf600d604e7ceb8ca7f8d (diff)
downloadlinux-9552e19f6fff86d9907bb088f8b1eb786562f9d3.tar.xz
bcachefs: Fix dio write path with loopback dio mode
When the iov_iter is a bvec iter, it's possible the IO was submitted from a kthread that didn't have an mm to switch to. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 8231c29a7534..77a893260fd8 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2110,7 +2110,7 @@ static long bch2_dio_write_loop(struct dio_write *dio)
while (1) {
iter_count = dio->iter.count;
- if (kthread)
+ if (kthread && dio->mm)
kthread_use_mm(dio->mm);
BUG_ON(current->faults_disabled_mapping);
current->faults_disabled_mapping = mapping;
@@ -2120,7 +2120,7 @@ static long bch2_dio_write_loop(struct dio_write *dio)
dropped_locks = fdm_dropped_locks();
current->faults_disabled_mapping = NULL;
- if (kthread)
+ if (kthread && dio->mm)
kthread_unuse_mm(dio->mm);
/*