Message ID | 20191212163904.159893-67-dgilbert@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtiofs daemon [all] | expand |
On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > From: Miklos Szeredi <mszeredi@redhat.com> > > No glibc support yet, so use syscall(). It exists in glibc in my Fedora 31 install. Presumably this is related to an older version > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > --- > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > index 91d3120033..bed2270141 100644 > --- a/tools/virtiofsd/passthrough_ll.c > +++ b/tools/virtiofsd/passthrough_ll.c > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > } > > if (flags) { > +#ifndef SYS_renameat2 > fuse_reply_err(req, EINVAL); > +#else > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > + lo_fd(req, newparent), newname, flags); > + if (res == -1 && errno == ENOSYS) { > + fuse_reply_err(req, EINVAL); > + } else { > + fuse_reply_err(req, res == -1 ? errno : 0); > + } > +#endif We should use the formal API if available as first choice Regards, Daniel
* Daniel P. Berrangé (berrange@redhat.com) wrote: > On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > > From: Miklos Szeredi <mszeredi@redhat.com> > > > > No glibc support yet, so use syscall(). > > It exists in glibc in my Fedora 31 install. > > Presumably this is related to an older version > > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > > --- > > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > > index 91d3120033..bed2270141 100644 > > --- a/tools/virtiofsd/passthrough_ll.c > > +++ b/tools/virtiofsd/passthrough_ll.c > > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > > } > > > > if (flags) { > > +#ifndef SYS_renameat2 > > fuse_reply_err(req, EINVAL); > > +#else > > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > > + lo_fd(req, newparent), newname, flags); > > + if (res == -1 && errno == ENOSYS) { > > + fuse_reply_err(req, EINVAL); > > + } else { > > + fuse_reply_err(req, res == -1 ? errno : 0); > > + } > > +#endif > > We should use the formal API if available as first choice OK, done - I've kept the 'ifndef SYS_renameat2' that drops back to an error for truly ancient cases; although I doubt everything else will build on something that old. Dave > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
* Dr. David Alan Gilbert (dgilbert@redhat.com) wrote: > * Daniel P. Berrangé (berrange@redhat.com) wrote: > > On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > > > From: Miklos Szeredi <mszeredi@redhat.com> > > > > > > No glibc support yet, so use syscall(). > > > > It exists in glibc in my Fedora 31 install. > > > > Presumably this is related to an older version > > > > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > > > --- > > > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > > > index 91d3120033..bed2270141 100644 > > > --- a/tools/virtiofsd/passthrough_ll.c > > > +++ b/tools/virtiofsd/passthrough_ll.c > > > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > > > } > > > > > > if (flags) { > > > +#ifndef SYS_renameat2 > > > fuse_reply_err(req, EINVAL); > > > +#else > > > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > > > + lo_fd(req, newparent), newname, flags); > > > + if (res == -1 && errno == ENOSYS) { > > > + fuse_reply_err(req, EINVAL); > > > + } else { > > > + fuse_reply_err(req, res == -1 ? errno : 0); > > > + } > > > +#endif > > > > We should use the formal API if available as first choice > > OK, done - I've kept the 'ifndef SYS_renameat2' that drops back to an > error for truly ancient cases; although I doubt everything else will > build on something that old. Hmm, and this breaks on middle age distros; older distros don't have it at all, new ones have both the syscall and the wrapper; but for the middle age ones they have the syscall but not the wrapper. Dan: What's your preference here; should I add a config fragment to detect the wrapper - it seems overkill rather than just reverting it until it becomes common. Dave > Dave > > > > > Regards, > > Daniel > > -- > > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > > |: https://libvirt.org -o- https://fstop138.berrange.com :| > > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On Mon, Jan 13, 2020 at 08:06:24PM +0000, Dr. David Alan Gilbert wrote: > * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote: > > * Daniel P. Berrangé (berrange@redhat.com) wrote: > > > On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > > > > From: Miklos Szeredi <mszeredi@redhat.com> > > > > > > > > No glibc support yet, so use syscall(). > > > > > > It exists in glibc in my Fedora 31 install. > > > > > > Presumably this is related to an older version > > > > > > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > > > > --- > > > > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > > > > index 91d3120033..bed2270141 100644 > > > > --- a/tools/virtiofsd/passthrough_ll.c > > > > +++ b/tools/virtiofsd/passthrough_ll.c > > > > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > > > > } > > > > > > > > if (flags) { > > > > +#ifndef SYS_renameat2 > > > > fuse_reply_err(req, EINVAL); > > > > +#else > > > > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > > > > + lo_fd(req, newparent), newname, flags); > > > > + if (res == -1 && errno == ENOSYS) { > > > > + fuse_reply_err(req, EINVAL); > > > > + } else { > > > > + fuse_reply_err(req, res == -1 ? errno : 0); > > > > + } > > > > +#endif > > > > > > We should use the formal API if available as first choice > > > > OK, done - I've kept the 'ifndef SYS_renameat2' that drops back to an > > error for truly ancient cases; although I doubt everything else will > > build on something that old. > > Hmm, and this breaks on middle age distros; older distros don't have it > at all, new ones have both the syscall and the wrapper; but for the > middle age ones they have the syscall but not the wrapper. > > Dan: What's your preference here; should I add a config fragment to > detect the wrapper - it seems overkill rather than just reverting it > until it becomes common. What specific middle age distro in particular is affected ? My general thought would be to /not/ support such distros. Focus on modern distros since this is a brand new feature in QEMU, where we should try to minimize support for legacy stuff at the start. But depending on the distro impacted, the might be a reason to stay with SYS_.. Regards, Daniel
* Daniel P. Berrangé (berrange@redhat.com) wrote: > On Mon, Jan 13, 2020 at 08:06:24PM +0000, Dr. David Alan Gilbert wrote: > > * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote: > > > * Daniel P. Berrangé (berrange@redhat.com) wrote: > > > > On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > > > > > From: Miklos Szeredi <mszeredi@redhat.com> > > > > > > > > > > No glibc support yet, so use syscall(). > > > > > > > > It exists in glibc in my Fedora 31 install. > > > > > > > > Presumably this is related to an older version > > > > > > > > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > > > > > --- > > > > > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > > > > > 1 file changed, 10 insertions(+) > > > > > > > > > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > > > > > index 91d3120033..bed2270141 100644 > > > > > --- a/tools/virtiofsd/passthrough_ll.c > > > > > +++ b/tools/virtiofsd/passthrough_ll.c > > > > > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > > > > > } > > > > > > > > > > if (flags) { > > > > > +#ifndef SYS_renameat2 > > > > > fuse_reply_err(req, EINVAL); > > > > > +#else > > > > > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > > > > > + lo_fd(req, newparent), newname, flags); > > > > > + if (res == -1 && errno == ENOSYS) { > > > > > + fuse_reply_err(req, EINVAL); > > > > > + } else { > > > > > + fuse_reply_err(req, res == -1 ? errno : 0); > > > > > + } > > > > > +#endif > > > > > > > > We should use the formal API if available as first choice > > > > > > OK, done - I've kept the 'ifndef SYS_renameat2' that drops back to an > > > error for truly ancient cases; although I doubt everything else will > > > build on something that old. > > > > Hmm, and this breaks on middle age distros; older distros don't have it > > at all, new ones have both the syscall and the wrapper; but for the > > middle age ones they have the syscall but not the wrapper. > > > > Dan: What's your preference here; should I add a config fragment to > > detect the wrapper - it seems overkill rather than just reverting it > > until it becomes common. > > What specific middle age distro in particular is affected ? My general > thought would be to /not/ support such distros. Focus on modern distros > since this is a brand new feature in QEMU, where we should try to > minimize support for legacy stuff at the start. But depending on the > distro impacted, the might be a reason to stay with SYS_.. The report came from Ubuntu 18.04 (which Intel uses on CI); that's not that old, so I think it sohuld be supported. I don't really see the justification for insisting on using the wrapper. Dave > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On Tue, Jan 14, 2020 at 10:07:03AM +0000, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berrange@redhat.com) wrote: > > On Mon, Jan 13, 2020 at 08:06:24PM +0000, Dr. David Alan Gilbert wrote: > > > * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote: > > > > * Daniel P. Berrangé (berrange@redhat.com) wrote: > > > > > On Thu, Dec 12, 2019 at 04:38:26PM +0000, Dr. David Alan Gilbert (git) wrote: > > > > > > From: Miklos Szeredi <mszeredi@redhat.com> > > > > > > > > > > > > No glibc support yet, so use syscall(). > > > > > > > > > > It exists in glibc in my Fedora 31 install. > > > > > > > > > > Presumably this is related to an older version > > > > > > > > > > > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> > > > > > > --- > > > > > > tools/virtiofsd/passthrough_ll.c | 10 ++++++++++ > > > > > > 1 file changed, 10 insertions(+) > > > > > > > > > > > > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c > > > > > > index 91d3120033..bed2270141 100644 > > > > > > --- a/tools/virtiofsd/passthrough_ll.c > > > > > > +++ b/tools/virtiofsd/passthrough_ll.c > > > > > > @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, > > > > > > } > > > > > > > > > > > > if (flags) { > > > > > > +#ifndef SYS_renameat2 > > > > > > fuse_reply_err(req, EINVAL); > > > > > > +#else > > > > > > + res = syscall(SYS_renameat2, lo_fd(req, parent), name, > > > > > > + lo_fd(req, newparent), newname, flags); > > > > > > + if (res == -1 && errno == ENOSYS) { > > > > > > + fuse_reply_err(req, EINVAL); > > > > > > + } else { > > > > > > + fuse_reply_err(req, res == -1 ? errno : 0); > > > > > > + } > > > > > > +#endif > > > > > > > > > > We should use the formal API if available as first choice > > > > > > > > OK, done - I've kept the 'ifndef SYS_renameat2' that drops back to an > > > > error for truly ancient cases; although I doubt everything else will > > > > build on something that old. > > > > > > Hmm, and this breaks on middle age distros; older distros don't have it > > > at all, new ones have both the syscall and the wrapper; but for the > > > middle age ones they have the syscall but not the wrapper. > > > > > > Dan: What's your preference here; should I add a config fragment to > > > detect the wrapper - it seems overkill rather than just reverting it > > > until it becomes common. > > > > What specific middle age distro in particular is affected ? My general > > thought would be to /not/ support such distros. Focus on modern distros > > since this is a brand new feature in QEMU, where we should try to > > minimize support for legacy stuff at the start. But depending on the > > distro impacted, the might be a reason to stay with SYS_.. > > The report came from Ubuntu 18.04 (which Intel uses on CI); that's not > that old, so I think it sohuld be supported. I don't really see the > justification for insisting on using the wrapper. Yeah, ok that's pretty new & will be around for a while yet. Regards, Daniel
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index 91d3120033..bed2270141 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -1083,7 +1083,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name, } if (flags) { +#ifndef SYS_renameat2 fuse_reply_err(req, EINVAL); +#else + res = syscall(SYS_renameat2, lo_fd(req, parent), name, + lo_fd(req, newparent), newname, flags); + if (res == -1 && errno == ENOSYS) { + fuse_reply_err(req, EINVAL); + } else { + fuse_reply_err(req, res == -1 ? errno : 0); + } +#endif return; }