[libvirt] [PATCH v7 2/6] add fuse support for libvirt lxc

Richard W.M. Jones rjones at redhat.com
Wed Nov 7 08:50:50 UTC 2012


On Wed, Nov 07, 2012 at 01:45:27PM +0800, Wanlong Gao wrote:
> On 11/07/2012 11:54 AM, Gao feng wrote:
> > 于 2012年11月06日 20:55, Richard W.M. Jones 写道:
> >> On Tue, Nov 06, 2012 at 07:50:33PM +0800, Gao feng wrote:
> >>> 于 2012年11月06日 17:11, Richard W.M. Jones 写道:
> >>>> On Tue, Nov 06, 2012 at 04:54:59PM +0800, Gao feng wrote:
> >>>>> Because libvirt_lxc create a thread to mount fuse filesystem.
> >>>>> and then libvirt_lxc will try to access the fuse filesystem.
> >>>>>
> >>>>> Without waiting,libvirt_lxc may access fuse before it is mounted.
> >>>>>
> >>>>> And I can't find a better way to make accessing fuse after the fuse
> >>>>> being mounted,because fuse_main will return until fuse being unmounted,so
> >>>>> I don't know how to pass message to tell libvirt_lxc whether the fuse is
> >>>>> mounted success.
> >>>>
> >>>> Oh I see.  This is solvable, but I believe that you cannot use
> >>>> fuse_main.  You have to look at the fuse sources (quite complex!)  and
> >>>> do the individual fuse operations.
> >>>>
> >>>> Have a look at how libguestfs does it ...
> >>>>
> >>>>   https://github.com/libguestfs/libguestfs/blob/master/src/fuse.c#L911
> >>>>   http://libguestfs.org/guestfs.3.html#mount-local
> >>>>
> >>>
> >>>
> >>> Thanks for the information.
> >>>
> >>> Can fuse_mount & fuse_new & fuse_loop avoid the waiting?
> >>>
> >>> It seems has the same problem.
> >>
> >> It waits, but it doesn't busy wait in a loop.  The first access to the
> >> filesystem hangs until the thread which is handling the filesystem is
> >> listening for requests.
> >>
> > 
> > It makes me confuse.
> > 
> > There are two threads(A and B).
> > thread A mounts fuse filesystem on mountpoint /mnt/fuse.
> > thread B try to access file /mnt/fuse/meminfo. and we don't
> > know which thread will execute first.
> > 
> > The information I got from your comment is that because thread A
> > doesn't mount fuse to /mnt/fuse, when thread B access to the
> > /mnt/fuse/meminfo,it will hang. I am right?
> 
> If I'm not wrong, I think Rich means that you should create the mountpoint
> and the operations using fuse_mount and fuse_new before you create the thread B,
> then make another thread A using fuse_loop to loop behind.  Then if thread B try
> to access the mountpoint before thread A runs, B will hang until thread A runs into the loop.

This is right.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the libvir-list mailing list