[PATCH RFC] nvmet: fix tmpfs-based backstores support

Maurizio Lombardi mlombard at redhat.com
Sun Nov 21 06:25:22 PST 2021


On Fri, Nov 19, 2021 at 06:02:33PM +0100, Christoph Hellwig wrote:
> The proper fix is to check if the file has FMODE_NOWAIT is set before
> using FMODE_NOWAIT for reads or writes, not to blindly disable it for
> reads.
>

Ah thanks for the info!
Now I see that filesystems that support NOWAIT set the FMODE_NOWAIT
flag in their open() functions.

So the correct patch should be the following:

diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 1dd1a0fe2e81..bf3f440c98d5 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->ns->file->f_mode & FMODE_NOWAIT) &&
                                nvmet_file_execute_io(req, IOCB_NOWAIT))
                        return;
                nvmet_file_submit_buffered_io(req);


I'm going to test it.

Maurizio




More information about the Linux-nvme mailing list