public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH RFC] nvmet: fix tmpfs-based backstores support
@ 2021-11-17 15:24 Maurizio Lombardi
  2021-11-18  1:59 ` Chaitanya Kulkarni
  2021-11-19 17:02 ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Maurizio Lombardi @ 2021-11-17 15:24 UTC (permalink / raw)
  To: kch; +Cc: linux-nvme, sagi, hch

commit 50a909db36f2 ("nvmet: use IOCB_NOWAIT for file-ns buffered I/O")
optimized the read command behaviour  when buffered file-ns
configurations are used.
It issues the read commands with the IOCB_NOWAIT flag set to try
to access the data from the cache.

However, the patch was buggy because both read and write commands are
issued with IOCB_NOWAIT, this broke tmpfs-based backstores because tmpfs
doesn't accept write commands with IOCB_NOWAIT.

Fix this bug by restricting IOCB_NOWAIT to read commands only.

Fixes: 50a909db36f2 ("nvmet: use IOCB_NOWAIT for file-ns buffered I/O")

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/nvme/target/io-cmd-file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 6aa30f30b572..1d9b41190583 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -266,6 +266,7 @@ static void nvmet_file_execute_rw(struct nvmet_req *req)
 
 	if (req->ns->buffered_io) {
 		if (likely(!req->f.mpool_alloc) &&
+				req->cmd->rw.opcode == nvme_cmd_read &&
 				nvmet_file_execute_io(req, IOCB_NOWAIT))
 			return;
 		nvmet_file_submit_buffered_io(req);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-21 14:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 15:24 [PATCH RFC] nvmet: fix tmpfs-based backstores support Maurizio Lombardi
2021-11-18  1:59 ` Chaitanya Kulkarni
2021-11-18  8:29   ` Maurizio Lombardi
2021-11-18  8:41     ` Chaitanya Kulkarni
2021-11-18  8:42     ` Chaitanya Kulkarni
2021-11-18  9:16       ` Maurizio Lombardi
2021-11-19 17:02 ` Christoph Hellwig
2021-11-21 14:25   ` Maurizio Lombardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox