virtiofsd: fix multiple unmappable writes from writev in fuse
PATCH 1/1 virtiofsd: fix multiple unmappable writes from writev in fuse
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 <[email protected]>
--- contrib/virtiofsd/fuse_virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/virtiofsd/fuse_virtio.c +2 -2
@@ -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; }
Signature · 1 line
1.8.3.1
Quoted 7 lines · * Liu Bo ([email protected]) 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 <[email protected]>
Thanks! I've squashed this down into my 'Parse unmappable elements'
Dave
Quoted 33 lines
--- contrib/virtiofsd/fuse_virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)contrib/virtiofsd/fuse_virtio.c +2
-2@@ -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; }Signature · 6 lines
1.8.3.1 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK