2001-12-12 00:14:16

by Elliot Lee

[permalink] [raw]
Subject: knfsd and FS_REQUIRES_DEV

I'm looking for information on knfsd's requirement that a filesystem be
FS_REQUIRES_DEV in order to export it. Would someone point me in the right
direction?

Needing to implement some not-quite-kosher exports,
-- Elliot


2001-12-12 00:20:37

by David Miller

[permalink] [raw]
Subject: Re: knfsd and FS_REQUIRES_DEV

From: Elliot Lee <[email protected]>
Date: Tue, 11 Dec 2001 19:13:48 -0500 (EST)

I'm looking for information on knfsd's requirement that a filesystem be
FS_REQUIRES_DEV in order to export it. Would someone point me in the right
direction?

Needing to implement some not-quite-kosher exports,

NFSD puts dev/ino into the filehandles it gives to the
client, it uses this to lookup the inode in question.

2001-12-12 00:46:17

by Elliot Lee

[permalink] [raw]
Subject: Re: knfsd and FS_REQUIRES_DEV

On Tue, 11 Dec 2001, David S. Miller wrote:

> From: Elliot Lee <[email protected]>
> Date: Tue, 11 Dec 2001 19:13:48 -0500 (EST)
>
> I'm looking for information on knfsd's requirement that a filesystem be
> FS_REQUIRES_DEV in order to export it. Would someone point me in the right
> direction?
>
> Needing to implement some not-quite-kosher exports,
>
> NFSD puts dev/ino into the filehandles it gives to the
> client, it uses this to lookup the inode in question.

I believe you're bringing up a requirement that inode numbers not change
while the filesystem is being exported, in order to avoid constant "stale
file handle" type of things. I can provide that guarantee (userland
filesystem via coda), but knfsd won't let me get that far because of its
more conservative policies right now.

I'm not worried about problems where files mysteriously disappear due to
me screwing up inode numbers in my code, only about causing kernel panics
or other Bad Things in the server's kernel. If I were to remove the
FS_REQUIRES_DEV check (or, more likely, submit a patch adding an nfsd
module option to remove the check...), what are the worst things that
could theoretically and realistically happen?

-- Elliot


2001-12-12 00:47:09

by Linus Torvalds

[permalink] [raw]
Subject: Re: knfsd and FS_REQUIRES_DEV

In article <[email protected]>,
David S. Miller <[email protected]> wrote:
> From: Elliot Lee <[email protected]>
> Date: Tue, 11 Dec 2001 19:13:48 -0500 (EST)
>
> I'm looking for information on knfsd's requirement that a filesystem be
> FS_REQUIRES_DEV in order to export it. Would someone point me in the right
> direction?
>
> Needing to implement some not-quite-kosher exports,
>
>NFSD puts dev/ino into the filehandles it gives to the
>client, it uses this to lookup the inode in question.

Well, that actually could work with things like /proc, which actually
has meaningful inode numbers. They may not be stable across reboots, of
course, nor even really stable in general, but in _theory_ there's
nothing to keep us from exporting /proc files and potentially other
virtual filesystems.

In practice I suspect there are tons of other problems, not the least of
which is that /proc doesn't give a proper filesize.

Other not-so-kosher filesystems (ie tmpfs) might be easier than /proc in
those respects.

Linus

2001-12-12 01:21:47

by NeilBrown

[permalink] [raw]
Subject: Re: knfsd and FS_REQUIRES_DEV

On Tuesday December 11, [email protected] wrote:
> I'm not worried about problems where files mysteriously disappear due to
> me screwing up inode numbers in my code, only about causing kernel panics
> or other Bad Things in the server's kernel. If I were to remove the
> FS_REQUIRES_DEV check (or, more likely, submit a patch adding an nfsd
> module option to remove the check...), what are the worst things that
> could theoretically and realistically happen?

If you just removed the check, the worst that would happen is that
after a server reboot you have to remount everything on your clients.

If you submit a patch to make it an option, the worst that can happen
is that I jump on you (but I'm not a good long jumper, so you are
pretty safe).

I plan to make a change to knfsd in the near future so that you can
have an option like:
fs=27
in /etc/exports and the the kernel puts the magic number "27" in the
filehandle instead of the device number. Then as long as you export
each filesystem with a unique and consistant fs number, you won't need
to worry about the instability of device numbers.

NeilBrown

2001-12-12 02:15:57

by Trond Myklebust

[permalink] [raw]
Subject: Re: knfsd and FS_REQUIRES_DEV

>>>>> " " == Linus Torvalds <[email protected]> writes:

> Well, that actually could work with things like /proc, which
> actually has meaningful inode numbers. They may not be stable
> across reboots, of course, nor even really stable in general,
> but in _theory_ there's nothing to keep us from exporting /proc
> files and potentially other virtual filesystems.

I'd be really interested in seeing an NFS client caching protocol that
could cope with this...

For /proc you don't even *want* stability across reboots. That said,
even if you did, the current VFS API is quite sufficient to allow you
to create a protocol that will satisfy those stability
requirements.

The important thing as far as NFS filehandles are concerned is that
the actual information you put in is invariant over reboots, and that
it suffices to locate a file uniquely. With the current API, that
means that we need at least one unique number to identify the actual
'super_operations->fh_to_dentry()' method to be used. Beyond
that, it is entirely up to the fs how it wants to interpret the rest
of the filehandle...

Cheers,
Trond