Linux 4.10: have_submounts is gone

Linux commit f74e7b33c37e vfs: remove unused have_submounts() function
(v4.10-rc2) removes have_submounts from the tree after providing a
replacement (path_has_submounts) for its last in-tree caller, autofs.

However, it turns out that OpenAFS is better off not using the new
path_has_submounts.  Instead, OpenAFS could/should have stopped using
have_submounts() much earlier, back in Linux v3.18 when d_invalidate
became void.  At that time, most in-tree callers of have_submounts had
already been converted to use check_submounts_and_drop back in v3.12.
At v3.18, a series of commits modified check_submounts_and_drop to
automatically remove child submounts (instead of returning -EBUSY if a
submount was detected), then subsumed it into d_invalidate.  The end
result was that VFS now implicitly handles much of the housekeeping
previously called explicitly by the various filesystem d_revalidate
routines:
- shrink_dcache_parent
- check_submounts_and_drop
- d_drop
- d_invalidate
All in-tree filesystem d_revalidate routines were updated to take
advantage of this new VFS support.

Modify afs_linux_dentry_revalidate to no longer perform any special
handling for invalid dentries when D_INVALIDATE_IS_VOID.  Instead, allow
our VFS caller to properly clean up any invalid dentry when we return 0.

Change-Id: I0c4d777e6d445857c395a7b5f9a43c9024b098e9
Reviewed-on: https://gerrit.openafs.org/12506
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Mark Vitale 2016-12-07 11:11:45 -05:00 committed by Benjamin Kaduk
parent 961cee00b8
commit 789319bf0f

View File

@ -1305,6 +1305,24 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
good_dentry:
valid = 1;
goto done;
bad_dentry:
valid = 0;
#ifndef D_INVALIDATE_IS_VOID
/* When (v3.18) d_invalidate was converted to void, it also started
* being called automatically from revalidate, and automatically
* handled:
* - shrink_dcache_parent
* - automatic detach of submounts
* - d_drop
* Therefore, after that point, OpenAFS revalidate logic no longer needs
* to do any of those things itself for invalid dentry structs. We only need
* to tell VFS it's invalid (by returning 0), and VFS will handle the rest.
*/
if (have_submounts(dp))
valid = 1;
#endif
done:
/* Clean up */
@ -1315,6 +1333,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
if (credp)
crfree(credp);
#ifndef D_INVALIDATE_IS_VOID
if (!valid) {
/*
* If we had a negative lookup for the name we want to forcibly
@ -1327,15 +1346,9 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
} else
d_invalidate(dp);
}
#endif
return valid;
bad_dentry:
if (have_submounts(dp))
valid = 1;
else
valid = 0;
goto done;
}
static void