diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-05-09 18:19:09 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-05-15 19:12:27 +0300 |
commit | e9833d8701028b5dd62895e68f4a280aad359172 (patch) | |
tree | 209ba6abb605902a617cec187e9e1ad0ab0c31fa /block/fops.c | |
parent | fe34db062b8036f72e97c2b9eaa7e9fbb725ead2 (diff) | |
download | linux-e9833d8701028b5dd62895e68f4a280aad359172.tar.xz |
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: linux-block@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230509151910.183637-3-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/fops.c')
-rw-r--r-- | block/fops.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/fops.c b/block/fops.c index d2e6be4e3d1c..ab750e8a040f 100644 --- a/block/fops.c +++ b/block/fops.c @@ -481,7 +481,7 @@ static int blkdev_open(struct inode *inode, struct file *filp) * during an unstable branch. */ filp->f_flags |= O_LARGEFILE; - filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC; + filp->f_mode |= FMODE_BUF_RASYNC; if (filp->f_flags & O_NDELAY) filp->f_mode |= FMODE_NDELAY; @@ -494,6 +494,9 @@ static int blkdev_open(struct inode *inode, struct file *filp) if (IS_ERR(bdev)) return PTR_ERR(bdev); + if (bdev_nowait(bdev)) + filp->f_mode |= FMODE_NOWAIT; + filp->private_data = bdev; filp->f_mapping = bdev->bd_inode->i_mapping; filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping); |