]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvmet: use IOCB_NOWAIT only if the filesystem supports it
authorMaurizio Lombardi <mlombard@redhat.com>
Mon, 22 Nov 2021 10:08:27 +0000 (11:08 +0100)
committerChristoph Hellwig <hch@lst.de>
Thu, 25 Nov 2021 14:02:40 +0000 (15:02 +0100)
Submit I/O requests with the IOCB_NOWAIT flag set only if
the underlying filesystem supports it.

Fixes: e0f635f9fa9f ("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>
drivers/nvme/target/io-cmd-file.c

index 6aa30f30b572ece0e1dd848ab878e20a20b6ebd0..6be6e59d273bb72c43bc2b106fc2df8ddfbd5622 100644 (file)
@@ -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
@@ -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