All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "misono.tomohiro@fujitsu.com" <misono.tomohiro@fujitsu.com>
Cc: "virtio-fs@redhat.com" <virtio-fs@redhat.com>
Subject: Re: [Virtio-fs] False error message when DAX cache is disabled
Date: Thu, 24 Oct 2019 18:13:34 +0100	[thread overview]
Message-ID: <20191024171334.GN2877@work-vm> (raw)
In-Reply-To: <OSBPR01MB37837B4AB38461063F645019E56A0@OSBPR01MB3783.jpnprd01.prod.outlook.com>

* misono.tomohiro@fujitsu.com (misono.tomohiro@fujitsu.com) wrote:
> Hi,

Hi Misono,

> I'm testing virtiofs on ARM enviroment.
> Since current ARM does not support DAX, I use cache-size=0 for vhost-user-fs-pci parameter.
> 
> This results in the following error message during unmount:
> ```
> vhost_user_fs_slave_unmap: unmap when DAX cache not present
> lo_destroy: unmap during destroy failed
> ```

Thanks for reporting this,

> This is because lo_destroy() always calls fuse_virtio_unmap().
> So, I want to fix this by not calling fuse_virtio_unmap() when cache is not used,
> but is there any good way for virtiofsd to know vhost-user's cahce-size?

Unfortunately not; that's why I used the special ~0 as a 'unmap all'.
It feels easier to fix the qemu side to be happy unmapping everything
when everything is actually nothing :-)

Does the following (build tested only) patch fix it:

diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index 6cacdb24b0..07a04d9b21 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -92,10 +92,6 @@ uint64_t vhost_user_fs_slave_unmap(struct vhost_dev *dev, VhostUserFSSlaveMsg *s
         return -1;
     }
     size_t cache_size = fs->conf.cache_size;
-    if (!cache_size) {
-        fprintf(stderr, "%s: unmap when DAX cache not present\n", __func__);
-        return (uint64_t)-1;
-    }
     void *cache_host = memory_region_get_ram_ptr(&fs->cache);
 
     unsigned int i;
@@ -106,13 +102,19 @@ uint64_t vhost_user_fs_slave_unmap(struct vhost_dev *dev, VhostUserFSSlaveMsg *s
      */
     for (i = 0; i < VHOST_USER_FS_SLAVE_ENTRIES; i++) {
         void *ptr;
+        if (sm->len[i] == ~(uint64_t)0) {
+            /* Special case meaning the whole arena */
+            sm->len[i] = cache_size;
+        }
+
         if (sm->len[i] == 0) {
             continue;
         }
 
-        if (sm->len[i] == ~(uint64_t)0) {
-            /* Special case meaning the whole arena */
-            sm->len[i] = cache_size;
+        if (!cache_size) {
+            fprintf(stderr, "%s: unmap when DAX cache not present\n", __func__);
+            res = -1;
+            break;
         }
 
         if ((sm->c_offset[i] + sm->len[i]) < sm->len[i] ||


> Thanks.
> Misono
> 
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs@redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


  reply	other threads:[~2019-10-24 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  9:05 [Virtio-fs] False error message when DAX cache is disabled misono.tomohiro
2019-10-24 17:13 ` Dr. David Alan Gilbert [this message]
2019-10-25 10:00   ` misono.tomohiro
2019-10-25 10:41     ` Dr. David Alan Gilbert

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=20191024171334.GN2877@work-vm \
    --to=dgilbert@redhat.com \
    --cc=misono.tomohiro@fujitsu.com \
    --cc=virtio-fs@redhat.com \
    /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.