Commit 1efcf39eb627573f8d543ea396cf36b0651b1e56
Committed by
Miklos Szeredi
1 parent
58ada94f95
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: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Showing 1 changed file with 12 additions and 5 deletions Side-by-side Diff
fs/fuse/virtio_fs.c
... | ... | @@ -48,11 +48,15 @@ |
48 | 48 | unsigned int num_request_queues; /* number of request queues */ |
49 | 49 | }; |
50 | 50 | |
51 | -struct virtio_fs_forget { | |
51 | +struct virtio_fs_forget_req { | |
52 | 52 | struct fuse_in_header ih; |
53 | 53 | struct fuse_forget_in arg; |
54 | +}; | |
55 | + | |
56 | +struct virtio_fs_forget { | |
54 | 57 | /* This request can be temporarily queued on virt queue */ |
55 | 58 | struct list_head list; |
59 | + struct virtio_fs_forget_req req; | |
56 | 60 | }; |
57 | 61 | |
58 | 62 | static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, |
... | ... | @@ -325,6 +329,7 @@ |
325 | 329 | struct virtqueue *vq; |
326 | 330 | int ret = 0; |
327 | 331 | bool notify; |
332 | + struct virtio_fs_forget_req *req = &forget->req; | |
328 | 333 | |
329 | 334 | spin_lock(&fsvq->lock); |
330 | 335 | if (!fsvq->connected) { |
... | ... | @@ -334,7 +339,7 @@ |
334 | 339 | goto out; |
335 | 340 | } |
336 | 341 | |
337 | - sg_init_one(&sg, forget, sizeof(*forget)); | |
342 | + sg_init_one(&sg, req, sizeof(*req)); | |
338 | 343 | vq = fsvq->vq; |
339 | 344 | dev_dbg(&vq->vdev->dev, "%s\n", __func__); |
340 | 345 | |
... | ... | @@ -730,6 +735,7 @@ |
730 | 735 | { |
731 | 736 | struct fuse_forget_link *link; |
732 | 737 | struct virtio_fs_forget *forget; |
738 | + struct virtio_fs_forget_req *req; | |
733 | 739 | struct virtio_fs *fs; |
734 | 740 | struct virtio_fs_vq *fsvq; |
735 | 741 | u64 unique; |
736 | 742 | |
737 | 743 | |
738 | 744 | |
... | ... | @@ -743,14 +749,15 @@ |
743 | 749 | |
744 | 750 | /* Allocate a buffer for the request */ |
745 | 751 | forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL); |
752 | + req = &forget->req; | |
746 | 753 | |
747 | - forget->ih = (struct fuse_in_header){ | |
754 | + req->ih = (struct fuse_in_header){ | |
748 | 755 | .opcode = FUSE_FORGET, |
749 | 756 | .nodeid = link->forget_one.nodeid, |
750 | 757 | .unique = unique, |
751 | - .len = sizeof(*forget), | |
758 | + .len = sizeof(*req), | |
752 | 759 | }; |
753 | - forget->arg = (struct fuse_forget_in){ | |
760 | + req->arg = (struct fuse_forget_in){ | |
754 | 761 | .nlookup = link->forget_one.nlookup, |
755 | 762 | }; |
756 | 763 |