nvmet: use IOCB_NOWAIT only if the filesystem supports it

[ Upstream commit c024b226a417c4eb9353ff500b1c823165d4d508 ]

Submit I/O requests with the IOCB_NOWAIT flag set only if
the underlying filesystem supports it.

Fixes: 50a909db36 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Maurizio Lombardi 2021-11-22 11:08:27 +01:00 committed by Greg Kroah-Hartman
parent d54662a91f
commit 25980820c4
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/fs.h>
#include "nvmet.h" #include "nvmet.h"
#define NVMET_MAX_MPOOL_BVEC 16 #define NVMET_MAX_MPOOL_BVEC 16
@ -254,7 +255,8 @@ static void nvmet_file_execute_rw(struct nvmet_req *req)
if (req->ns->buffered_io) { if (req->ns->buffered_io) {
if (likely(!req->f.mpool_alloc) && 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; return;
nvmet_file_submit_buffered_io(req); nvmet_file_submit_buffered_io(req);
} else } else