linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about pseudo filesystems
@ 2002-09-04 18:02 Jamie Lokier
  2002-09-07 12:00 ` Daniel Phillips
  0 siblings, 1 reply; 90+ messages in thread
From: Jamie Lokier @ 2002-09-04 18:02 UTC (permalink / raw)
  To: Alex Viro, linux-kernel

I have a small problem with a module I'm writing.  It uses a
pseudo-filesystem, rather like futexes and pipes, so that it can hand
out special file descriptors on request.

Following the examples of pipe.c and futex.c, but specifically for a 2.4
kernel, I'm doing this:

	static DECLARE_FSTYPE (mymod_fs_type, "mymod_fs",
			       mymod_read_super, FS_NOMOUNT);


	static int __init mymod_init (void)
	{
		int err = register_filesystem (&mymod_fs_type);
		if (err)
			return err;
		mymod_mnt = kern_mount (&mymod_fs_type);
		if (IS_ERR (mymod_mnt)) {
			unregister_filesystem (&mymod_fs_type);
			return PTR_ERR (mymod_mnt);
		}
	}

	static void __exit mymod_exit (void)
	{
		mntput (mymod_mnt);
		unregister_filesystem (&mymod_fs_type);
	}

Unfortunately, when I come to _unload_ the module, it can't be unloaded
because the kern_mount increments the module reference count.

(pipe.c in 2.4 appears to have the same problem, but of course nobody
can ever unload it anyway so it doesn't matter).

I'm handing out file descriptors rather like futexes from 2.5: they all
share the same dentry, which is the root of the filesystem.  In my
code's case, that dentry is created in `mymod_read_super' (just the same
way as 2.4 pipe.c).

Somehow, it looks like I need to mount the filesystem when it first
generates an fd, and unmount it when the last fd is destroyed -- but is
it safe to unmount the filesystem _within_ a release function of an
inode on the filesystem?

Either that, or I need something else.

Thanks,
-- Jamie


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

end of thread, other threads:[~2002-10-01 14:22 UTC | newest]

Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-04 18:02 Question about pseudo filesystems Jamie Lokier
2002-09-07 12:00 ` Daniel Phillips
2002-09-07 13:36   ` Alexander Viro
2002-09-07 18:27     ` Jamie Lokier
2002-09-07 19:47       ` Alexander Viro
2002-09-08  2:21         ` Jamie Lokier
2002-09-08  2:43           ` Alexander Viro
2002-09-15  1:41             ` Moving a mount point (was Re: Question about pseudo filesystems) Rob Landley
2002-09-08 16:00           ` Question about pseudo filesystems Daniel Phillips
2002-09-09 19:48             ` Jamie Lokier
2002-09-09 20:06               ` Daniel Phillips
2002-09-10  0:44                 ` Jamie Lokier
2002-09-10  1:40                   ` Daniel Phillips
2002-09-10  1:56                     ` Jamie Lokier
2002-09-10  2:53                       ` Daniel Phillips
2002-09-10  3:26                         ` Jamie Lokier
2002-09-10  3:47                           ` Daniel Phillips
2002-09-10  9:15                   ` Daniel Phillips
2002-09-10 10:17                     ` Roman Zippel
2002-09-11 18:35                       ` [RFC] Raceless module interface Daniel Phillips
2002-09-11 18:53                         ` Oliver Neukum
2002-09-11 19:20                           ` Daniel Phillips
2002-09-11 20:29                             ` Oliver Neukum
2002-09-11 21:15                               ` Daniel Phillips
2002-09-11 21:26                                 ` Jamie Lokier
2002-09-11 21:47                                   ` Daniel Phillips
2002-09-12  1:42                                     ` Rusty Russell
2002-09-12  2:09                                       ` Jamie Lokier
2002-09-12  3:13                                         ` Rusty Russell
2002-09-12  3:47                                           ` Daniel Phillips
2002-09-12  3:53                                             ` Alexander Viro
2002-09-12  4:11                                               ` Daniel Phillips
2002-09-12  4:40                                                 ` Rusty Russell
2002-09-12  5:27                                                   ` Daniel Phillips
2002-09-12 14:46                                                   ` Gerhard Mack
2002-09-13  0:39                                                     ` Rusty Russell
2002-09-13  2:23                                                       ` Daniel Phillips
2002-09-12  5:35                                                 ` Rusty Russell
2002-09-12  4:52                                             ` Rusty Russell
2002-09-12  5:58                                               ` Daniel Phillips
2002-09-12  7:00                                                 ` Rusty Russell
2002-09-13  8:18                                           ` Helge Hafting
2002-09-12  3:32                                         ` Daniel Phillips
2002-09-12  1:31                         ` Rusty Russell
2002-09-12  9:10                         ` Oliver Neukum
2002-09-12 11:27                         ` Roman Zippel
2002-09-12 13:03                           ` Rusty Russell
2002-09-12 13:44                             ` Roman Zippel
2002-09-13  1:30                               ` Rusty Russell
2002-09-13  2:19                                 ` Daniel Phillips
2002-09-13  6:51                                   ` Rusty Russell
2002-09-13 13:34                                     ` Daniel Phillips
2002-09-13 13:52                                       ` Thunder from the hill
2002-09-13 14:09                                         ` Daniel Phillips
2002-09-13 14:33                                           ` Thunder from the hill
2002-09-13 14:44                                             ` Daniel Phillips
2002-09-13 14:59                                               ` Thunder from the hill
2002-09-13 15:17                                                 ` Daniel Phillips
2002-09-13 15:27                                                   ` Thunder from the hill
2002-09-13 15:37                                                     ` Daniel Phillips
2002-09-16  2:17                                       ` Rusty Russell
2002-09-16 16:13                                         ` Daniel Phillips
2002-09-16 16:36                                         ` Understanding the Principles of Argumentation #3 Daniel Phillips
2002-09-16 16:42                                           ` Robinson Maureira Castillo
2002-09-16 17:29                                           ` Cort Dougan
2002-09-16 22:31                                         ` David Woodhouse
2002-10-01 14:13                                           ` Daniel Phillips
2002-10-01 14:27                                           ` David Woodhouse
2002-09-13 15:59                                     ` [RFC] Raceless module interface Daniel Phillips
2002-09-13  3:14                                 ` David Gibson
2002-09-13 10:35                                 ` Roman Zippel
2002-09-13 13:53                                   ` Daniel Phillips
2002-09-13 15:13                                     ` Roman Zippel
2002-09-13 15:30                                       ` Daniel Phillips
2002-09-13 15:55                                         ` Roman Zippel
2002-09-13 16:09                                           ` Daniel Phillips
2002-09-13 16:39                                         ` Thunder from the hill
2002-09-13 17:12                                           ` Daniel Phillips
2002-09-16  0:24                                         ` Bill Davidsen
2002-09-16  1:49                                   ` Rusty Russell
2002-09-16 21:36                                     ` Roman Zippel
2002-09-16 21:48                                       ` Daniel Phillips
2002-09-16 22:44                                         ` Roman Zippel
2002-09-11 15:28                 ` Question about pseudo filesystems Bill Davidsen
2002-09-11 19:36                   ` Daniel Phillips
2002-09-09 20:12               ` Daniel Phillips
2002-09-09 22:56                 ` Jamie Lokier
2002-09-10  1:39                   ` Alexander Viro
2002-09-09 20:18               ` Daniel Phillips
2002-09-10  6:48                 ` Kai Henningsen

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