linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Rename dir on server can cause client to get ESTALE
@ 2011-11-14  2:19 NeilBrown
  2011-12-01  1:49 ` Rename dir on server can cause client to get ESTALE - this time with PATCH NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2011-11-14  2:19 UTC (permalink / raw)
  To: Trond Myklebust, NFS, Alexander Viro

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]


hi,
  I've run into another issue that seems to related to FS_REVAL_DOT.

The script below makes the details precise, but the essence is that if I 'cd'
into a directory on the client, then rename it on the server, then it is
possible that the client will start getting ESTALE when accessing '.' - even
though the directory still exists.

The ESTALE is generated because nfs_lookup_revalidate fails on the dentry, so 
complete_walk (in fs/namei.c) gets failure from d_revalidate() and so sets the
status to -ESTALE.

nfs_lookup_revalidate fails because when it repeats the lookup it sees a
different directory (as you will see the script creates a new directory with
the old name).

I think it only makes sense to do a ->lookup revalidate of the dentry at the
end of the path when there was a real non '.' or '..' name leading to the
dentry.  If we were just looking up '.', we want to revalidate the inode, but
not the dentry.

Unfortunately I cannot see how that distinction could be introduced into the
current path-walk code.

Any ideas?

Thanks,
NeilBrown


SERVER=eli     # name of server.  ssh access required.
DIR=/home      # directory on server to mount
MPOINT=/mnt    # location on client to mount it.
TMP=/neilb/tmp # path to scratch area in $DIR

sudo umount $MPOINT
sudo mount -o vers=3 $SERVER:$DIR $MPOINT

cd /
ssh $SERVER "rm -r $DIR$TMP/*dir*"
ssh $SERVER "mkdir $DIR$TMP/adir"
while [ ! -d $MPOINT$TMP/adir ];
do echo -n . ; sleep 2;
done
cd $MPOINT$TMP/adir || exit
echo "Entered directory"
ls -la > /dev/null
ssh $SERVER "cd $DIR$TMP; mv adir adir.moved"
echo "Moved directory on server"
ls -la > /dev/null
echo -n "Waiting for move to be visible on client"
while ls -la $MPOINT$TMP/adir >/dev/null 2>&1
do echo -n . 
   sleep 3
   (cd / ; ssh $SERVER "cd $DIR$TMP; mkdir bdir ; rmdir bdir" )
done
echo
echo "Make replacement directory on server"
(cd / ; ssh $SERVER "cd $DIR$TMP; mkdir adir")
ls -la $MPOINT$TMP/adir
ls -la


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-01  2:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14  2:19 Rename dir on server can cause client to get ESTALE NeilBrown
2011-12-01  1:49 ` Rename dir on server can cause client to get ESTALE - this time with PATCH NeilBrown
2011-12-01  2:12   ` Al Viro
2011-12-01  2:24     ` Trond Myklebust
2011-12-01  2:47       ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).