From: "Dr. David Alan Gilbert (git)" Date: Wed, 28 Apr 2021 12:00:51 +0100 Message-Id: <20210428110100.27757-18-dgilbert@redhat.com> In-Reply-To: <20210428110100.27757-1-dgilbert@redhat.com> References: <20210428110100.27757-1-dgilbert@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Virtio-fs] [PATCH v3 17/26] DAX: virtiofsd: Perform an unmap on destroy List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, vgoyal@redhat.com, stefanha@redhat.com, groug@kaod.org Cc: virtio-fs@redhat.com From: "Dr. David Alan Gilbert" Force unmap all remaining dax cache entries on a destroy. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/passthrough_ll.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index ed5b6c9e2d..600e102839 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -3129,6 +3129,20 @@ static void lo_destroy(void *userdata, struct fuse_session *se) { struct lo_data *lo = (struct lo_data *)userdata; + if (fuse_lowlevel_is_virtio(se)) { + VhostUserFSSlaveMsg *msg = g_malloc0(sizeof(VhostUserFSSlaveMsg) + + sizeof(VhostUserFSSlaveMsgEntry)); + + msg->count = 0; + msg->entries[0].len = ~(uint64_t)0; /* Special: means 'all' */ + msg->entries[0].c_offset = 0; + if (fuse_virtio_unmap(se, msg)) { + fuse_log(FUSE_LOG_ERR, "%s: unmap during destroy failed\n", + __func__); + } + g_free(msg); + } + pthread_mutex_lock(&lo->mutex); while (true) { GHashTableIter iter; -- 2.31.1