qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "misono.tomohiro@fujitsu.com" <misono.tomohiro@fujitsu.com>
Cc: "virtio-fs@redhat.com" <virtio-fs@redhat.com>,
	'Miklos Szeredi' <mszeredi@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation
Date: Fri, 25 Oct 2019 14:54:16 +0200	[thread overview]
Message-ID: <20191025125416.GE13314@stefanha-x1.localdomain> (raw)
In-Reply-To: <OSBPR01MB3783A810FEC4C2F3AE7248BAE56B0@OSBPR01MB3783.jpnprd01.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2253 bytes --]

On Wed, Oct 23, 2019 at 11:42:50AM +0000, misono.tomohiro@fujitsu.com wrote:
> > -----Original Message-----
> > From: Stefan Hajnoczi [mailto:stefanha@redhat.com]
> > Sent: Monday, October 21, 2019 6:41 PM
> > To: Misono, Tomohiro/味曽野 智礼 <misono.tomohiro@fujitsu.com>
> > Cc: 'Miklos Szeredi' <mszeredi@redhat.com>; virtio-fs@redhat.com; qemu-devel@nongnu.org
> > Subject: Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation
> > 
> > On Fri, Oct 18, 2019 at 08:51:20AM +0000, misono.tomohiro@fujitsu.com wrote:
> > > > Doing unshare(CLONE_FS) after thread startup seems safe, though must
> > > > be careful to change the working directory to the root of the mount
> > > > *before* starting any threads.
> > >
> > > I think working directry is changed in setup_sandbox() -> setup_mount_namespace() -> setup_pivot_root().
> > > So, can we just add unshare(CLONE_FS) in fv_queue_worker()?
> > 
> > fv_queue_worker() is the thread pool worker function that is called for each request.  Calling unshare(CLONE_FS) for each request
> > is not necessary and will reduce performance.
> > 
> > A thread-local variable can be used to avoid repeated calls to
> > unshare(CLONE_FS) from the same worker thread:
> > 
> >   static __thread bool clone_fs_called;
> > 
> >   static void fv_queue_worker(gpointer data, gpointer user_data)
> >   {
> >       ...
> >       if (!clone_fs_called) {
> >           int ret;
> > 
> > 	  ret = unshare(CLONE_FS);
> > 	  assert(ret == 0); /* errors not expected according to man page */
> > 
> > 	  clone_fs_called = true;
> >       }
> > 
> > Another issue is the seccomp policy.  Since worker threads are spawned at runtime it is necessary to add the unshare(2) syscall
> > to the seccomp whitelist in contrib/virtiofsd/seccomp.c.
> > 
> 
> Thanks for suggesting.
> 
> I tried above code with fchdir() + ...xattr() + fchdir() in lo_...xattr
> and it solves all the problem about xattr I see.
> 
> However, it seems the fix causes some performance issue in stress test
> as ACL check issues getxattr() and a lot of fchdir() happens. So, I may
> try to combine the old method for regular file and this method for special
> files.

Sounds good.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-10-25 12:56 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
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 [this message]
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=20191025125416.GE13314@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=misono.tomohiro@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).