Thread (8 messages) 8 messages, 3 authors, 2021-11-21

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

From: Maurizio Lombardi <hidden>
Date: 2021-11-21 14:25:48
Subsystem: nvm express target driver, the rest · Maintainers: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, Linus Torvalds

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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help