mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
direct-io: Fix sleep in atomic due to sync AIO
Commite864f39569"fs: add RWF_DSYNC aand RWF_SYNC" added additional way for direct IO to become synchronous and thus trigger fsync from the IO completion handler. Then commit9830f4be15"fs: Use RWF_* flags for AIO operations" allowed these flags to be set for AIO as well. However that commit forgot to update the condition checking whether the IO completion handling should be defered to a workqueue and thus AIO DIO with RWF_[D]SYNC set will call fsync() from IRQ context resulting in sleep in atomic. Fix the problem by checking directly iocb flags (the same way as it is done in dio_complete()) instead of checking all conditions that could lead to IO being synchronous. CC: Christoph Hellwig <[email protected]> CC: Goldwyn Rodrigues <[email protected]> CC: [email protected] Reported-by: Mark Rutland <[email protected]> Tested-by: Mark Rutland <[email protected]> Fixes:9830f4be15Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
ba989a0146
commit
d9c10e5b88
1 changed files with 1 additions and 2 deletions
|
|
@ -1274,8 +1274,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
|
|||
*/
|
||||
if (dio->is_async && iov_iter_rw(iter) == WRITE) {
|
||||
retval = 0;
|
||||
if ((iocb->ki_filp->f_flags & O_DSYNC) ||
|
||||
IS_SYNC(iocb->ki_filp->f_mapping->host))
|
||||
if (iocb->ki_flags & IOCB_DSYNC)
|
||||
retval = dio_set_defer_completion(dio);
|
||||
else if (!dio->inode->i_sb->s_dio_done_wq) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue