linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to unmount mounts corresponding to super_block structure?
@ 2013-02-27  6:35 Anatol Pomozov
  2013-02-27  6:56 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Anatol Pomozov @ 2013-02-27  6:35 UTC (permalink / raw)
  To: linux-fsdevel

Hi,

I am working on fuse changes to cleanup (unmount) mountpoint on
filesystem daemon crash. Currently unmounting is done as a part of
user-space daemon shutdown hook, but in case if the daemon gets
SIGKILL or SIGSEGV the hook is not executed and mountpoint is left
unmounted. I want to move the cleanup code to kernel.

Now I need to call umount() from inside kernel code (from
fuse_dev_release() in fs/fuse/dev.c). I see do_umount() function in
fs/namespace.c it sounds like what I need. Unfortunately this function
accepts struct mount and all I have is super_block structure.

What I am trying to do is to iterate current filesystem namespace and
find mountpoints that correspond to super_block. Namespace can have
multiple corresponding mountpoints in case of bind mounts. Here is
code that seems to work fine http://pastebin.com/xLECPGa4 . Now I am
trying to understand what synchronization is required for this code.
It looks like access to nsproxy->mnt_ns->list should be done with
namespace_sem held. Unfortunately that semaphore is internal to
fs/namespace.c. It is not clear for me how I suppose to iterate the
mount list.

Is there any advice/code example how to umount() mountpoints for a
given super_block?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-27  7:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27  6:35 How to unmount mounts corresponding to super_block structure? Anatol Pomozov
2013-02-27  6:56 ` Al Viro
2013-02-27  7:19   ` Anatol Pomozov
2013-02-27  7:43     ` Al Viro

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).