Skip to content

Commit

Permalink
nvmet: use IOCB_NOWAIT only if the filesystem supports it
Browse files Browse the repository at this point in the history
Submit I/O requests with the IOCB_NOWAIT flag set only if
the underlying filesystem supports it.

Fixes: 50a909d ("nvmet: use IOCB_NOWAIT for file-ns buffered I/O")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Maurizio Lombardi authored and Christoph Hellwig committed Nov 25, 2021
1 parent 00b33cf commit c024b22
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/nvme/target/io-cmd-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/uio.h>
#include <linux/falloc.h>
#include <linux/file.h>
#include <linux/fs.h>
#include "nvmet.h"

#define NVMET_MAX_MPOOL_BVEC 16
Expand Down Expand Up @@ -266,7 +267,8 @@ static void nvmet_file_execute_rw(struct nvmet_req *req)

if (req->ns->buffered_io) {
if (likely(!req->f.mpool_alloc) &&
nvmet_file_execute_io(req, IOCB_NOWAIT))
(req->ns->file->f_mode & FMODE_NOWAIT) &&
nvmet_file_execute_io(req, IOCB_NOWAIT))
return;
nvmet_file_submit_buffered_io(req);
} else
Expand Down

0 comments on commit c024b22

Please sign in to comment.