All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: kch@nvidia.com
Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de
Subject: [PATCH RFC] nvmet: fix tmpfs-based backstores support
Date: Wed, 17 Nov 2021 16:24:54 +0100	[thread overview]
Message-ID: <20211117152454.122014-1-mlombard@redhat.com> (raw)

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



             reply	other threads:[~2021-11-17 15:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 15:24 Maurizio Lombardi [this message]
2021-11-18  1:59 ` [PATCH RFC] nvmet: fix tmpfs-based backstores support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211117152454.122014-1-mlombard@redhat.com \
    --to=mlombard@redhat.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.