[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation
From: |
Miklos Szeredi |
Subject: |
Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation |
Date: |
Thu, 17 Oct 2019 18:48:33 +0200 |
On Thu, Oct 17, 2019 at 6:09 PM Stefan Hajnoczi <address@hidden> wrote:
>
> On Thu, Oct 17, 2019 at 01:23:57PM +0200, Miklos Szeredi wrote:
> > On Thu, Oct 17, 2019 at 12:05 PM Stefan Hajnoczi <address@hidden> wrote:
> > >
> > > On Wed, Oct 16, 2019 at 07:37:52PM +0900, Misono Tomohiro wrote:
> > > > Hello,
> > > >
> > > > I test xattr operation on virtiofs using xfstest generic/062
> > > > (with -o xattr option and XFS backend) and see some problems.
> > > >
> > > > These patches fixes the two of the problems.
> > > >
> > > > The remaining problems are:
> > > > 1. we cannot xattr to block device created by mknod
> > > > which does not have actual device (since open in virtiofsd fails)
> > > > 2. we cannot xattr to symbolic link
> > > >
> > > > I don't think 1 is a big problem but can we fix 2?
> > >
> > > Sorry, I don't know the answer. Maybe it would be necessary to add a
> > > new O_SYMLINK open flag to open(2) so that fgetxattr()/fsetxattr()
> > > operations can be performed. A kernel change like that would take some
> > > time to get accepted upstream and shipped by distros, but it might be
> > > the only way since the current syscall interface doesn't seem to offer a
> > > way to do this.
> >
> > The real problem is that open() on a non-regular, non-directory file
> > may have side effects (unless O_PATH is used). These patches try to
> > paper over that, but the fact is: opening special files from a file
> > server is forbidden.
> >
> > I see why this is being done, and it's not easy to fix properly
> > without the ..at() versions of these syscalls. One idea is to fork()
> > + fchdir(lo->proc_self_fd) + ..xattr(). Another related idea is to do
> > a unshare(CLONE_FS) after each thread's startup (will pthread library
> > balk? I don't know) so that it's safe to do fchdir(lo->proc_self_fd)
> > + ...xattr() + fchdir(lo->root_fd).
>
> Looking at the f*xattr() code in the kernel, it doesn't really care
> about the file descriptor, it wants the inode instead. So the O_SYMLINK
> idea I mentioned could also be called O_XATTR and be similar to O_PATH,
> except that only f*xattr() calls are allowed on this file descriptor.
Even simpler: allow O_PATH descriptors for f*xattr().
Thanks,
Miklos
- [PATCH 0/2] virtiofsd: Two fix for xattr operation, Misono Tomohiro, 2019/10/16
- [PATCH 2/2] virtiofsd: Allow setxattr operation to directry, Misono Tomohiro, 2019/10/16
- [PATCH 1/2] virtiofsd: Avoid process hang when doing xattr operation to FIFO, Misono Tomohiro, 2019/10/16
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Miklos Szeredi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation,
Miklos Szeredi <=
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Miklos Szeredi, 2019/10/18
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/18
- RE: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, address@hidden, 2019/10/18
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/21
- RE: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, address@hidden, 2019/10/23
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/25