Skip to content

Commit c024b22

Browse files
maurizio-lombardiChristoph Hellwig
authored andcommitted
nvmet: use IOCB_NOWAIT only if the filesystem supports it
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 <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 00b33cf commit c024b22

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/nvme/target/io-cmd-file.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/uio.h>
99
#include <linux/falloc.h>
1010
#include <linux/file.h>
11+
#include <linux/fs.h>
1112
#include "nvmet.h"
1213

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

267268
if (req->ns->buffered_io) {
268269
if (likely(!req->f.mpool_alloc) &&
269-
nvmet_file_execute_io(req, IOCB_NOWAIT))
270+
(req->ns->file->f_mode & FMODE_NOWAIT) &&
271+
nvmet_file_execute_io(req, IOCB_NOWAIT))
270272
return;
271273
nvmet_file_submit_buffered_io(req);
272274
} else

0 commit comments

Comments
 (0)