[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fuse-devel
Subject:    Re: [fuse-devel] "blocking" cleanup code executed at umount
From:       Goswin von Brederlow <goswin-v-b () web ! de>
Date:       2011-12-21 14:25:01
Message-ID: 8762hauhmq.fsf () frosties ! localnet
[Download RAW message or body]

Miklos Szeredi <miklos@szeredi.hu> writes:

> Stefan Westerfeld <stefan@space.twc.de> writes:
>
>>    Hi!
>>
>> I'd like to implement
>>
>> myfusefs bar            # mount 1
>> fusermount -u bar       # unmount 1
>> myfusefs bar            # mount 2
>>
>> so that my FuSE filesystem runs initialization code first, cleans up during the
>> unmount and runs initialization code again. So I'd like to be sure that before
>> "mount 2", the old FuSE filesystem cleanup code is done.
>>
>> Otherwise the initialization and cleanup of "unmount 1" and "mount 2" will
>> probably not work, because they are operating on the same data.
>>
>> Is there a way to ensure that fusermount -u ... blocks long enough so that my
>> cleanup code will be completely executed by the time the user can
>> remount?
>
> Not really.
>
> But you can use a lock file (e.g. lockf(3)) to prevent two instances of
> the filesystem running at the same time.

What about filesystems of type fuseblk, where you have a real device and
tell fuse about it? Does fuse or the kernel do adequate locking on the
device for you?

>> Also, do I assume correctly that for starting a FuSE filesystem, if I put my
>> init code into the fuse_init function, "mount 1/2" will block long enough so
>> that after the process exits, the filesystem will be properly initialized,
>> right?
>
> No, the init function is called after the filesystem daemon is already
> in the background.
>
> But you can and should put part of the initialization that can normally
> fail into your main() function instead of into the init callback.
>
> Thanks,
> Miklos

What about umount? destroy() has no reply so the umount can't wait on
that? What does it wait on?

MfG
        Goswin

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic