Re: [PATCH 2/2] fat (exportfs): reconnect file handles to evictedinodes/dentries

From: Steven J. Magnani
Date: Mon Jul 09 2012 - 16:26:14 EST


On Tue, 2012-07-10 at 04:10 +0900, OGAWA Hirofumi wrote:
> "Steven J. Magnani" <steve@xxxxxxxxxxxxxxx> writes:
>
> >> > >> > Interesting idea. I think this, and reformulating the FAT NFS file
> >> > >> > handle to include the parent's i_ino, will greatly simplify (and speed
> >> > >> > up) the code.
> >> > >>
> >> > >> Does it work even if the inode was rename()'ed?
> >> > >
> >> > > AFAICT. I don't see why it wouldn't; on a rename, the inode's i_pos
> >> > > changes but its i_ino stays the same, right?
> >> >
> >> > If the inode is not on cache anymore, is there the possibility that
> >> > selects the wrong parent? IIRC, NFS Server can be rebooted at any time
> >> > while the client using the same file handle.
> >>
> >> True, but it's looking like we can just use the default handle
> >> constructed by export_encode_fh(), namely (i_ino, i_generation,
> >> parent->i_ino, parent->i_generation). None of those components should
> >> change in a server reboot.
> >
> > I think I misunderstood you when I wrote this. I assumed we were talking
> > about a restart of nfsd, not the entire machine it was running on. If
> > there is a danger of mismapping on a reboot isn't that present in the
> > existing mainline code, i.e. fat_fh_to_dentry()? Ideally, the (i_ino,
> > i_generation) signature would be different on a reboot, although with
> > only 2-second granularity in i_generation I suppose that's less likely
> > than we would prefer. Also I would think that many inodes simply
> > wouldn't exist in the cache, in which case we would fail the operation
> > with ESTALE.
>
> Ah, i_ino. I was talking about i_pos. Well, so, what happens if the
> child was renamed to other parent on NFS server machine (not via nfs
> client)? The file handle would be including the old i_ino, and the old
> i_ino on file handle is still vaild as old parent. So, it returns the
> wrong parent?

Yes, but I believe exportfs_decode_fh() handles that case:

/*
* Now that we've got both a well-connected parent and a
* dentry for the inode we're after, make sure that our
* inode is actually connected to the parent.
*/


Really, the FAT NFS code will pretty much parallel that of ext2.
------------------------------------------------------------------------
Steven J. Magnani "I claim this network for MARS!
www.digidescorp.com Earthling, return my space modulator!"

#include <standard.disclaimer>



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/