|
6 | 6 | #include <linux/module.h>
|
7 | 7 | #include <linux/compiler.h>
|
8 | 8 | #include <linux/fs.h>
|
| 9 | +#include <linux/fscrypt.h> |
9 | 10 | #include <linux/pagemap.h>
|
10 | 11 | #include <linux/iomap.h>
|
11 | 12 | #include <linux/backing-dev.h>
|
@@ -179,11 +180,14 @@ static void iomap_dio_bio_end_io(struct bio *bio)
|
179 | 180 | static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio,
|
180 | 181 | loff_t pos, unsigned len)
|
181 | 182 | {
|
| 183 | + struct inode *inode = file_inode(dio->iocb->ki_filp); |
182 | 184 | struct page *page = ZERO_PAGE(0);
|
183 | 185 | int flags = REQ_SYNC | REQ_IDLE;
|
184 | 186 | struct bio *bio;
|
185 | 187 |
|
186 | 188 | bio = bio_alloc(GFP_KERNEL, 1);
|
| 189 | + fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, |
| 190 | + GFP_KERNEL); |
187 | 191 | bio_set_dev(bio, iter->iomap.bdev);
|
188 | 192 | bio->bi_iter.bi_sector = iomap_sector(&iter->iomap, pos);
|
189 | 193 | bio->bi_private = dio;
|
@@ -310,6 +314,8 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
|
310 | 314 | }
|
311 | 315 |
|
312 | 316 | bio = bio_alloc(GFP_KERNEL, nr_pages);
|
| 317 | + fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, |
| 318 | + GFP_KERNEL); |
313 | 319 | bio_set_dev(bio, iomap->bdev);
|
314 | 320 | bio->bi_iter.bi_sector = iomap_sector(iomap, pos);
|
315 | 321 | bio->bi_write_hint = dio->iocb->ki_hint;
|
|
0 commit comments