From: Stefan Hajnoczi <stefanha@redhat.com>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: virtio-fs@redhat.com,
Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>,
qemu-devel@nongnu.org
Subject: Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation
Date: Thu, 17 Oct 2019 17:09:53 +0100 [thread overview]
Message-ID: <20191017160953.GC1266@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAOssrKfR=sfE1RzOXzvPbdQg-g7i5-f8W9y8bWFnO=gyJ2VMsg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]
On Thu, Oct 17, 2019 at 01:23:57PM +0200, Miklos Szeredi wrote:
> On Thu, Oct 17, 2019 at 12:05 PM Stefan Hajnoczi <stefanha@redhat.com> 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.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-10-17 17:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 10:37 [PATCH 0/2] virtiofsd: Two fix for xattr operation Misono Tomohiro
2019-10-16 10:37 ` [PATCH 1/2] virtiofsd: Avoid process hang when doing xattr operation to FIFO Misono Tomohiro
2019-10-16 10:37 ` [PATCH 2/2] virtiofsd: Allow setxattr operation to directry Misono Tomohiro
2019-10-17 10:05 ` [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation Stefan Hajnoczi
2019-10-17 11:23 ` Miklos Szeredi
2019-10-17 13:01 ` Miklos Szeredi
2019-10-17 15:25 ` Vivek Goyal
2019-10-17 15:45 ` Miklos Szeredi
2019-10-17 16:09 ` Stefan Hajnoczi [this message]
2019-10-17 16:48 ` Miklos Szeredi
2019-10-18 7:16 ` Miklos Szeredi
2019-10-18 8:51 ` misono.tomohiro
2019-10-21 9:40 ` Stefan Hajnoczi
2019-10-23 11:42 ` misono.tomohiro
2019-10-25 12:54 ` Stefan Hajnoczi
2019-10-18 10:09 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191017160953.GC1266@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=misono.tomohiro@jp.fujitsu.com \
--cc=mszeredi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=virtio-fs@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).