exportfs: stop retrying once we race with rename/remove
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 17 Oct 2013 01:09:30 +0000 (21:09 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 9 Nov 2013 05:16:36 +0000 (00:16 -0500)
commita056cc8934c7bd046dc44af559bba163115fde40
treee007654068f0be8dc2559b6c033cbba54f4e75dc
parent0dbc018a490ed482a1236aad77ac12e20742b322
exportfs: stop retrying once we race with rename/remove

There are two places here where we could race with a rename or remove:

- We could find the parent, but then be removed or renamed away
  from that parent directory before finding our name in that
  directory.
- We could find the parent, and find our name in that parent,
  but then be renamed or removed before we look ourselves up by
  that name in that parent.

In both cases the concurrent rename or remove will take care of
reconnecting the directory that we're currently examining.  Our target
directory should then also be connected.  Check this and clear
DISCONNECTED in these cases instead of looping around again.

Note: we *do* need to check that this actually happened if we want to be
robust in the face of corrupted filesystems: a corrupted filesystem
could just return a completely wrong parent, and we want to fail with an
error in that case before starting to clear DISCONNECTED on
non-DISCONNECTED filesystems.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/exportfs/expfs.c