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

From: Steven J. Magnani
Date: Mon Jul 09 2012 - 08:03:40 EST


On Sun, 2012-07-08 at 02:00 +0900, OGAWA Hirofumi wrote:
> "Steven J. Magnani" <steve@xxxxxxxxxxxxxxx> writes:
>
> >> You mean the unhashed inode is created by ->get_parent()? If so, the
> >> root cause sounds like ->get_parent() itself. If not, I'm not
> >> understanding the meaning of the temporary/unofficial inode here.
> >
> > Maybe "private" is a better word than "unofficial". Private inodes are
> > created anywhere fat_new_inode (nee fat_build_unhashed_inode) is called
> > directly, instead of through fat_build_inode. So yes, this is on the
> > get_parent paths (via fat_lookup_dir), and also on the fh_to_dentry path
> > when inode reconstruction is necessary.
> >
> > With private inodes, I don't see how anyone but the code that created
> > them could find them to lock them. The reason they're private is that
> > they're temporary aliases; at the time they're created, we don't have
> > enough information to register them in a way that others could find
> > them. A lookup, etc. operation will look for the inode of the "drivers"
> > directory, not the ".." of the "usb" directory. We do need these private
> > inodes in order to walk directory entries. I don't think they're a
> > problem that needs solving; if we didn't use private inodes, we'd still
> > need a way to walk directory entries in the context of these NFS
> > operations, and there would still be potential races between that and
> > other operations on the filesystem.
>
> How do you prevent to modify or free the those inode/blocks from other
> path? Yeah, it is racy. And if races is not solved, that's simply wrong
> and not solution.
>
> Although I'm not thinking deeply about NFS support on FAT. Just a idea,
> the one of possible solutions would be register it to hash, and find it
> on all path. So, all path will use same inode and lock.
>
> We need the key, possible key is - if it is only directory, FAT may be
> able to use i_start as additional search key.

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.

I am having a hard time seeing how inclusion of i_pos in the file handle
is useful. The only scenarios I can conceive where an i_ino lookup fails
and an i_pos lookup succeeds are the object referenced by the file
handle has:

(A) been replaced by something else,
or (2) had its inode evicted, but later re-instantiated

Perhaps the design was intended to support case (2), but since the file
handle of the re-instantiated inode will differ from the original (since
i_ino and i_generation will have changed), NFS clients will cry ESTALE
anyway.

Steve


--
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/