NFS stale-filehandles
Roger Heflin
rheflin at atipa.com
Tue Dec 19 17:11:51 UTC 2006
T. Horsnell wrote:
>> T. Horsnell wrote:
>>
>>> This is just the job. I dont even have to use udev to get
>>> persistent device names if I use LABEL= in fstab. One question
>>> though:
>>>
>>> In the absence of an fsid= option, how does Linux compute a
>>> filesystem handle? Unless I know this, or unless I provide
>>> an fsid= option for *all* my exported filesystems, I risk
>>> choosing an id which may collide with the Linux-generated one.
>>>
>>> Thanks,
>>> Terry
>>>
>>
>> Trond (nfs maintainer) indicated to someone
>> else on the kernel list:
>> stat --printf "%D\n" /filesystem
>
> Roger, thanks for this pointer. My 'stat' (FC6 updated as of today)
> seems to have some oddities. To get filesystem-id as opposed to
> device-id I have to:
>
> stat --printf "%i\n" -f /filesystem
>
> and when I do this all my filesystem-id's are zero.
>
> stat --printf "%D\n" /filesystem
>
> gets me a device-id which seems to be 256*majorno+minorno
That is the correct numbering I believe. fsid is a generated
id by nfs, it does not actually exist on the filesystem, doing
the %D shows what nfs would generate.
>
> Maybe I should try and contact Trond.
>
>> Will print out the fsid for that filesystem on the
>> nfs server, the stat command does seem to have some
>> different arguements rather than --printf so if it yells
>> read the man page and change the arguement.
>>
>> In situations where the major/minor could change, I add
>> fsid to all filesystems.
>>
>> Also note that if you export the same filesystem twice
>> then it has the same fsid and only one set of permissions
>> ie both mounts are either rw or ro (probably whichever
>> is last), and if you use separate fsid's for each, the
>> permissions for each can now be different.
>
> Do you mean that an /etc/exports which contains:
>
> /fs1 client1(rw,fsid=1) client2(ro,fsid=1)
>
> will be readonly by client1 and client2, whereas
>
> /fs1 client1(rw,fsid=1) client2(ro,fsid=2)
>
> will be rw by client1 and ro by client2 ?
You probably need to separate that on two lines,
maybe, I have not played with it enough to know.
And it may need to be different directories.
I would probably join the NFS list if you are heavily
using NFS, and ask/search their archives.
>
> I wonder what happens with:
>
> /fs1 client1(rw,fsid=1) client2(ro)
> or
> /fs1 client1(rw) client2(ro,fsid=1)
>
> maybe I'll do the experiment, but I wish there was a spec for
> this. Undocumented properties have a habit of changing at the
> drop of a kernel version.
Yeah. The fsid stuff is used heavily by the
high-availability stuff so no one will probably touch it
too much.
Roger
More information about the fedora-list
mailing list