All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work
@ 2020-01-13  9:37 Xiao Yang
  2020-01-13  9:37 ` [Virtio-fs] [PATCH 2/2] virtiofsd/passthrough_ll: Only call posix_fallocate() when it is supported Xiao Yang
  2020-01-14 12:14 ` [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Dr. David Alan Gilbert
  0 siblings, 2 replies; 5+ messages in thread
From: Xiao Yang @ 2020-01-13  9:37 UTC (permalink / raw)
  To: virtio-fs

1) Use correct CONFIG_FALLOCATE macro to check if fallocate() is supported.(i.e configure
   script sets CONFIG_FALLOCATE intead of HAVE_FALLOCATE if fallocate() is supported)
2) Avoid 'Bad file descriptor' error by passing correct fd to fallocate().

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tools/virtiofsd/passthrough_ll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 42a3e182f9..a19823caaf 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -2313,8 +2313,8 @@ static void lo_fallocate(fuse_req_t req, fuse_ino_t ino, int mode, off_t offset,
     struct lo_data *lo = lo_data(req);
     (void)ino;
 
-#ifdef HAVE_FALLOCATE
-    err = fallocate(fi->fh, mode, offset, length);
+#ifdef CONFIG_FALLOCATE
+    err = fallocate(lo_fi_fd(req, fi), mode, offset, length);
     if (err < 0) {
         err = errno;
     }
-- 
2.21.0





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

* [Virtio-fs] [PATCH 2/2] virtiofsd/passthrough_ll: Only call posix_fallocate() when it is supported
  2020-01-13  9:37 [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Xiao Yang
@ 2020-01-13  9:37 ` Xiao Yang
  2020-01-14 12:14 ` [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Dr. David Alan Gilbert
  1 sibling, 0 replies; 5+ messages in thread
From: Xiao Yang @ 2020-01-13  9:37 UTC (permalink / raw)
  To: virtio-fs

passthrough_ll sets HAVE_POSIX_FALLOCATE macro compulsively so posix_fallocate()
is always called even if it is not supported.  Replace HAVE_POSIX_FALLOCATE with
CONFIG_POSIX_FALLOCATE.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tools/virtiofsd/passthrough_ll.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index a19823caaf..196664d52b 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -72,8 +72,6 @@
 #include "passthrough_helpers.h"
 #include "seccomp.h"
 
-#define HAVE_POSIX_FALLOCATE 1
-
 /* Keep track of inode posix locks for each owner. */
 struct lo_inode_plock {
     uint64_t lock_owner;
@@ -2319,7 +2317,7 @@ static void lo_fallocate(fuse_req_t req, fuse_ino_t ino, int mode, off_t offset,
         err = errno;
     }
 
-#elif defined(HAVE_POSIX_FALLOCATE)
+#elif defined(CONFIG_POSIX_FALLOCATE)
     if (mode) {
         fuse_reply_err(req, EOPNOTSUPP);
         return;
-- 
2.21.0





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

* Re: [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work
  2020-01-13  9:37 [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Xiao Yang
  2020-01-13  9:37 ` [Virtio-fs] [PATCH 2/2] virtiofsd/passthrough_ll: Only call posix_fallocate() when it is supported Xiao Yang
@ 2020-01-14 12:14 ` Dr. David Alan Gilbert
  2020-01-14 12:26   ` Xiao Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2020-01-14 12:14 UTC (permalink / raw)
  To: Xiao Yang; +Cc: virtio-fs

* Xiao Yang (yangx.jy@cn.fujitsu.com) wrote:
> 1) Use correct CONFIG_FALLOCATE macro to check if fallocate() is supported.(i.e configure
>    script sets CONFIG_FALLOCATE intead of HAVE_FALLOCATE if fallocate() is supported)
> 2) Avoid 'Bad file descriptor' error by passing correct fd to fallocate().
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  tools/virtiofsd/passthrough_ll.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index 42a3e182f9..a19823caaf 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -2313,8 +2313,8 @@ static void lo_fallocate(fuse_req_t req, fuse_ino_t ino, int mode, off_t offset,
>      struct lo_data *lo = lo_data(req);
>      (void)ino;
>  
> -#ifdef HAVE_FALLOCATE
> -    err = fallocate(fi->fh, mode, offset, length);
> +#ifdef CONFIG_FALLOCATE
> +    err = fallocate(lo_fi_fd(req, fi), mode, offset, length);

Thanks; I've merged the fh fix into Stefan's 'add fd_map to hide file
descriptors'
patch.

I'll merge the ifdef fix with your next fix and take it as a separate 
patch.

Dave

>      if (err < 0) {
>          err = errno;
>      }
> -- 
> 2.21.0
> 
> 
> 
> 
> _______________________________________________
> 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] 5+ messages in thread

* Re: [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work
  2020-01-14 12:14 ` [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Dr. David Alan Gilbert
@ 2020-01-14 12:26   ` Xiao Yang
  2020-01-14 12:28     ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-01-14 12:26 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: virtio-fs

On 2020/1/14 20:14, Dr. David Alan Gilbert 写wrote:
> Thanks; I've merged the fh fix into Stefan's 'add fd_map to hide file
> descriptors'
> patch.
>
> I'll merge the ifdef fix with your next fix and take it as a separate
> patch.
Hi Dave,

Thanks for your review and explanation.
Do you mean that I don't need to send v2 patch?

Thanks,
Xiao Yang
>
> Dave





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

* Re: [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work
  2020-01-14 12:26   ` Xiao Yang
@ 2020-01-14 12:28     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2020-01-14 12:28 UTC (permalink / raw)
  To: Xiao Yang; +Cc: virtio-fs

* Xiao Yang (yangx.jy@cn.fujitsu.com) wrote:
> On 2020/1/14 20:14, Dr. David Alan Gilbert 写wrote:
> > Thanks; I've merged the fh fix into Stefan's 'add fd_map to hide file
> > descriptors'
> > patch.
> > 
> > I'll merge the ifdef fix with your next fix and take it as a separate
> > patch.
> Hi Dave,
> 
> Thanks for your review and explanation.
> Do you mean that I don't need to send v2 patch?

Correct; I've merged together the patches you sent.
I'll push a new -dev just as soon as I've done a basic smoke test.

Dave

> Thanks,
> Xiao Yang
> > 
> > Dave
> 
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

end of thread, other threads:[~2020-01-14 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  9:37 [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Xiao Yang
2020-01-13  9:37 ` [Virtio-fs] [PATCH 2/2] virtiofsd/passthrough_ll: Only call posix_fallocate() when it is supported Xiao Yang
2020-01-14 12:14 ` [Virtio-fs] [PATCH 1/2] vitriofsd/passthrough_ll: Make fallocate() work Dr. David Alan Gilbert
2020-01-14 12:26   ` Xiao Yang
2020-01-14 12:28     ` 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.