Skip to content

Commit e9833d8

Browse files
committed
block: mark bdev files as FMODE_NOWAIT if underlying device supports it
We set this unconditionally, but it really should be dependent on if the underlying device is nowait compliant. Cc: [email protected] Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent fe34db0 commit e9833d8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

block/fops.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int blkdev_open(struct inode *inode, struct file *filp)
481481
* during an unstable branch.
482482
*/
483483
filp->f_flags |= O_LARGEFILE;
484-
filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
484+
filp->f_mode |= FMODE_BUF_RASYNC;
485485

486486
if (filp->f_flags & O_NDELAY)
487487
filp->f_mode |= FMODE_NDELAY;
@@ -494,6 +494,9 @@ static int blkdev_open(struct inode *inode, struct file *filp)
494494
if (IS_ERR(bdev))
495495
return PTR_ERR(bdev);
496496

497+
if (bdev_nowait(bdev))
498+
filp->f_mode |= FMODE_NOWAIT;
499+
497500
filp->private_data = bdev;
498501
filp->f_mapping = bdev->bd_inode->i_mapping;
499502
filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping);

0 commit comments

Comments
 (0)