[Virtio-fs] False error message when DAX cache is disabled

Dr. David Alan Gilbert dgilbert at redhat.com
Thu Oct 24 17:13:34 UTC 2019


* misono.tomohiro at fujitsu.com (misono.tomohiro at 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs
--
Dr. David Alan Gilbert / dgilbert at redhat.com / Manchester, UK




More information about the Virtio-fs mailing list