FUSE FORGET requests on umount

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FUSE FORGET requests on umount

Joshua J. Berry
When an unmount request is received for a FUSE filesystem, does the kernel
send FORGET requests for all inodes it's still holding?

I don't know how difficult this would be to implement if it's not there
already, but it would be a useful thing to have, since my filesystem has to
keep in-memory data structures for inodes (and I can't just free them all,
since some parts of the filesystem daemon may still have references to
them).

Thanks.

-- Josh

--
Joshua J. Berry

"I haven't lost my mind -- it's backed up on tape somewhere."
    -- /usr/games/fortune

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FUSE FORGET requests on umount

Miklos Szeredi
> When an unmount request is received for a FUSE filesystem, does the kernel
> send FORGET requests for all inodes it's still holding?

It does, but it's not guaranteed, that it actually reaches the
filesystem.

The probelm is that FORGET is totally asynchronous, so there's no way
to let the filesystem process all forgets before proceding with the
umount.

> I don't know how difficult this would be to implement if it's not there
> already, but it would be a useful thing to have, since my filesystem has to
> keep in-memory data structures for inodes (and I can't just free them all,
> since some parts of the filesystem daemon may still have references to
> them).

You can use reference counting on your inodes.  It's a bit redundant,
because they are also refcounted in the kernel, but it's the simplest
way to solve this particular problem.

Miklos


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: FUSE FORGET requests on umount

Joshua J. Berry
On Tuesday 23 August 2005 01:42, Miklos Szeredi wrote:
> > When an unmount request is received for a FUSE filesystem, does the
> > kernel send FORGET requests for all inodes it's still holding?
>
> It does, but it's not guaranteed, that it actually reaches the
> filesystem.
>
> The probelm is that FORGET is totally asynchronous, so there's no way
> to let the filesystem process all forgets before proceding with the
> umount.

ahhh.

> > I don't know how difficult this would be to implement if it's not there
> > already, but it would be a useful thing to have, since my filesystem
> > has to keep in-memory data structures for inodes (and I can't just free
> > them all, since some parts of the filesystem daemon may still have
> > references to them).
>
> You can use reference counting on your inodes.  It's a bit redundant,
> because they are also refcounted in the kernel, but it's the simplest
> way to solve this particular problem.

I actually do use reference counting ... but I use the same reference
counter for FUSE references as I do for internal in-memory references. ;)  

I'm trying to figure out how to make sure all FUSE references get removed
after unmount, without getting rid of the in-memory references.  I was
hoping I'd be able to get away without adding something to the public API
(my core filesystem functionality is split out into a library, and the
daemon itself mainly contains glue code between FUSE and the library), but
it doesn't sound like that's feasible.

Oh well.  Thanks.

-- Josh

--
Joshua J. Berry

"I haven't lost my mind -- it's backed up on tape somewhere."
    -- /usr/games/fortune

attachment0 (196 bytes) Download Attachment