Commit 1efcf39e authored by Vivek Goyal's avatar Vivek Goyal Committed by Miklos Szeredi

virtiofs: Do not send forget request "struct list_head" element

We are sending whole of virtio_fs_forget struct to the other end over
virtqueue. Other end does not need to see elements like "struct list".
That's internal detail of guest kernel. Fix it.
Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 58ada94f
...@@ -48,11 +48,15 @@ struct virtio_fs { ...@@ -48,11 +48,15 @@ struct virtio_fs {
unsigned int num_request_queues; /* number of request queues */ unsigned int num_request_queues; /* number of request queues */
}; };
struct virtio_fs_forget { struct virtio_fs_forget_req {
struct fuse_in_header ih; struct fuse_in_header ih;
struct fuse_forget_in arg; struct fuse_forget_in arg;
};
struct virtio_fs_forget {
/* This request can be temporarily queued on virt queue */ /* This request can be temporarily queued on virt queue */
struct list_head list; struct list_head list;
struct virtio_fs_forget_req req;
}; };
static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
...@@ -325,6 +329,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq, ...@@ -325,6 +329,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
struct virtqueue *vq; struct virtqueue *vq;
int ret = 0; int ret = 0;
bool notify; bool notify;
struct virtio_fs_forget_req *req = &forget->req;
spin_lock(&fsvq->lock); spin_lock(&fsvq->lock);
if (!fsvq->connected) { if (!fsvq->connected) {
...@@ -334,7 +339,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq, ...@@ -334,7 +339,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
goto out; goto out;
} }
sg_init_one(&sg, forget, sizeof(*forget)); sg_init_one(&sg, req, sizeof(*req));
vq = fsvq->vq; vq = fsvq->vq;
dev_dbg(&vq->vdev->dev, "%s\n", __func__); dev_dbg(&vq->vdev->dev, "%s\n", __func__);
...@@ -730,6 +735,7 @@ __releases(fiq->lock) ...@@ -730,6 +735,7 @@ __releases(fiq->lock)
{ {
struct fuse_forget_link *link; struct fuse_forget_link *link;
struct virtio_fs_forget *forget; struct virtio_fs_forget *forget;
struct virtio_fs_forget_req *req;
struct virtio_fs *fs; struct virtio_fs *fs;
struct virtio_fs_vq *fsvq; struct virtio_fs_vq *fsvq;
u64 unique; u64 unique;
...@@ -743,14 +749,15 @@ __releases(fiq->lock) ...@@ -743,14 +749,15 @@ __releases(fiq->lock)
/* Allocate a buffer for the request */ /* Allocate a buffer for the request */
forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL); forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL);
req = &forget->req;
forget->ih = (struct fuse_in_header){ req->ih = (struct fuse_in_header){
.opcode = FUSE_FORGET, .opcode = FUSE_FORGET,
.nodeid = link->forget_one.nodeid, .nodeid = link->forget_one.nodeid,
.unique = unique, .unique = unique,
.len = sizeof(*forget), .len = sizeof(*req),
}; };
forget->arg = (struct fuse_forget_in){ req->arg = (struct fuse_forget_in){
.nlookup = link->forget_one.nlookup, .nlookup = link->forget_one.nlookup,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment