All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-fs] [PATCH] virtiofsd: fix multiple unmappable writes from writev in fuse
@ 2019-05-23  1:06 Liu Bo
  2019-05-23 15:52 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2019-05-23  1:06 UTC (permalink / raw)
  To: virtio-fs

Commit (a2c2817 virtiofsd: Parse unmappable elements) assumes that there
is only one iovec in "out", which is not true if a writev with multiple
write iovec is done from fuse.

This fills the gap.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 contrib/virtiofsd/fuse_virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/virtiofsd/fuse_virtio.c b/contrib/virtiofsd/fuse_virtio.c
index 8306ed5..cb46558 100644
--- a/contrib/virtiofsd/fuse_virtio.c
+++ b/contrib/virtiofsd/fuse_virtio.c
@@ -557,7 +557,7 @@ static void *fv_queue_thread(void *opaque)
                        if (bad_in_num || bad_out_num) {
                            bool handled_unmappable = false;
 
-                           if (out_num > 2 && out_num_readable == 2 && !bad_in_num &&
+                           if (out_num > 2 && out_num_readable >= 2 && !bad_in_num &&
                                out_sg[0].iov_len == sizeof(struct fuse_in_header) &&
                                ((struct fuse_in_header *)fbuf.mem)->opcode ==
                                    FUSE_WRITE &&
@@ -585,7 +585,7 @@ static void *fv_queue_thread(void *opaque)
                                for(; iovindex < out_num; iovindex++, pbufvindex++) {
                                        pbufv->count++;
                                        pbufv->buf[pbufvindex].pos = ~0; // Dummy
-                                       pbufv->buf[pbufvindex].flags = FUSE_BUF_PHYS_ADDR;
+                                       pbufv->buf[pbufvindex].flags = (iovindex < out_num_readable) ? 0 : FUSE_BUF_PHYS_ADDR;
                                        pbufv->buf[pbufvindex].mem = out_sg[iovindex].iov_base;
                                        pbufv->buf[pbufvindex].size = out_sg[iovindex].iov_len;
                                }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Virtio-fs] [PATCH] virtiofsd: fix multiple unmappable writes from writev in fuse
  2019-05-23  1:06 [Virtio-fs] [PATCH] virtiofsd: fix multiple unmappable writes from writev in fuse Liu Bo
@ 2019-05-23 15:52 ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Dr. David Alan Gilbert @ 2019-05-23 15:52 UTC (permalink / raw)
  To: Liu Bo; +Cc: virtio-fs

* Liu Bo (bo.liu@linux.alibaba.com) wrote:
> Commit (a2c2817 virtiofsd: Parse unmappable elements) assumes that there
> is only one iovec in "out", which is not true if a writev with multiple
> write iovec is done from fuse.
> 
> This fills the gap.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>

Thanks! I've squashed this down into my 'Parse unmappable elements'

Dave

> ---
>  contrib/virtiofsd/fuse_virtio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/virtiofsd/fuse_virtio.c b/contrib/virtiofsd/fuse_virtio.c
> index 8306ed5..cb46558 100644
> --- a/contrib/virtiofsd/fuse_virtio.c
> +++ b/contrib/virtiofsd/fuse_virtio.c
> @@ -557,7 +557,7 @@ static void *fv_queue_thread(void *opaque)
>                         if (bad_in_num || bad_out_num) {
>                             bool handled_unmappable = false;
>  
> -                           if (out_num > 2 && out_num_readable == 2 && !bad_in_num &&
> +                           if (out_num > 2 && out_num_readable >= 2 && !bad_in_num &&
>                                 out_sg[0].iov_len == sizeof(struct fuse_in_header) &&
>                                 ((struct fuse_in_header *)fbuf.mem)->opcode ==
>                                     FUSE_WRITE &&
> @@ -585,7 +585,7 @@ static void *fv_queue_thread(void *opaque)
>                                 for(; iovindex < out_num; iovindex++, pbufvindex++) {
>                                         pbufv->count++;
>                                         pbufv->buf[pbufvindex].pos = ~0; // Dummy
> -                                       pbufv->buf[pbufvindex].flags = FUSE_BUF_PHYS_ADDR;
> +                                       pbufv->buf[pbufvindex].flags = (iovindex < out_num_readable) ? 0 : FUSE_BUF_PHYS_ADDR;
>                                         pbufv->buf[pbufvindex].mem = out_sg[iovindex].iov_base;
>                                         pbufv->buf[pbufvindex].size = out_sg[iovindex].iov_len;
>                                 }
> -- 
> 1.8.3.1
> 
> _______________________________________________
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-23 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-23  1:06 [Virtio-fs] [PATCH] virtiofsd: fix multiple unmappable writes from writev in fuse Liu Bo
2019-05-23 15:52 ` Dr. David Alan Gilbert

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.