2c056b2ccb
Revert the supporting logic in -r1.190 of vfs_lookup.c, and fix the important change to set searchdir = NULL instead of searchdir = foundobj. Then supply the necessary new supporting logic to cope with some new cases where searchdir can be null. This is at the point when lookup_once crosses a mountpoint going down; the idea was to avoid coupling locks across filesystems as that has a number of potentially negative consequences. At this stage of namei, though, it's important to set searchdir to null as this is what is used later on to handle other cases arising from crossing mount points. If you set it to be the same as foundobj, that instead creates the impression that you looked up "/." on the new volume, and that causes odd things to happen in corner cases such as the one appearing in PR 47040. This fix ought to be pulled up to -6 and -7, and it probably could be safely, but given the delicacy of this code and the fact that it's taken me more than three years to find the combination of time and intestinal fortitude to do it, as well as the minor nature of the resulting wrong behavior observed so far, I think we'll let that part go. This change also exposes an annoying corner case: if you cross a mount point and the root directory vnode of the new volume is not a directory but a symlink, we now have no searchdir to follow the symlink relative to. In principle one could hang onto the searchdir from before calling lookup_once and use that, or complexify the interface of lookup_once to hang onto it as desired for this case. Alternatively one could add the necessary null checks to namei_follow and allow only absolute symlinks in this case, as for an absolute symlink one doesn't need the old searchdir. However, given that only broken filesystems have symlinks as their root vnodes, I'm not going to bother. Instead if this happens we'll just fail with ENOTDIR. |
||
---|---|---|
bin | ||
common | ||
compat | ||
crypto | ||
dist/pf | ||
distrib | ||
doc | ||
etc | ||
external | ||
extsrc | ||
games | ||
gnu | ||
include | ||
lib | ||
libexec | ||
regress | ||
rescue | ||
sbin | ||
share | ||
sys | ||
tests | ||
tools | ||
usr.bin | ||
usr.sbin | ||
build.sh | ||
BUILDING | ||
Makefile | ||
Makefile.inc | ||
UPDATING |