Re: [PATCH 9/9] nfs: don't open in ->d_revalidate

From: Myklebust, Trond
Date: Tue Mar 06 2012 - 09:12:54 EST


On Tue, 2012-03-06 at 13:56 +0100, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@xxxxxxx>
>
> NFSv4 can't do reliable opens in d_revalidate, since it cannot know whether a
> mount needs to be followed or not. It does check d_mountpoint() on the dentry,
> which can result in a weird error if the VFS found that the mount does not in
> fact need to be followed, e.g.:
>
> # mount --bind /mnt/nfs /mnt/nfs-clone
> # echo something > /mnt/nfs/tmp/bar
> # echo x > /tmp/file
> # mount --bind /tmp/file /mnt/nfs-clone/tmp/bar
> # cat /mnt/nfs/tmp/bar
> cat: /mnt/nfs/tmp/bar: Not a directory
>
> Which should, by any sane filesystem, result in "something" being printed.
>
> So instead do the open in f_op->open() and in the unlikely case that the cached
> dentry turned out to be invalid, drop the dentry and return ESTALE to let the
> VFS retry.

This patch would force a complete new walk of the path in cases where
today we just do a single lookup of the last component. It really
doesn't seem worth taking that penalty just in order to make some insane
bind mount corner cases work.

--
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_