Commit Graph

184 Commits

Author SHA1 Message Date
dholland
bd77476310 Hack for PR 44961: restore the prior "logic" pertaining to looking up /
to prevent a crash when attempting rename("/", "foo"). This is not really
what I want going forward and it may cause e.g. rmdir("blah/") to fail, so
if it causes trouble for anyone back it out. The right fix is going to have
to wait until the qemu/tcp_vtw problems I ran into last night get sorted out.
2011-05-16 15:09:31 +00:00
dholland
66bcf26abf Simplify logic: at the bottom of the loop, instead of checking if we
should continue and if not breaking unconditionally, check if we
should break and if not use the bottom of the loop to continue to the
next iteration.
2011-04-18 00:47:24 +00:00
dholland
34cecc956d Goto considered harmful: now the "goto alldone" can be dropped by
reversing the sense of the associated test and using the big block I
moved a couple versions back (and didn't reindent on purpose) as the
body of the if statement.

There are now no gotos in namei_oneroot, only normal loop logic.
2011-04-18 00:47:04 +00:00
dholland
d5da8807ec The "goto alldone" from a couple patches back (inside the loop) can
now be changed to a loop break and another null test and goto outside
the loop. In neither of the other two cases for exiting the loop can
foundobj be null.
2011-04-18 00:46:39 +00:00
dholland
4e686966b9 Goto considered harmful: "goto terminal" can now just be "break". 2011-04-18 00:46:14 +00:00
dholland
58f787872f Move the big chunk of code at "terminal:" outside the loop; since it
has an unconditional loop break at the end this can be done safely,
now that the other loop break has been patched out.

Add a spurious set of braces to preserve the indent for the moment.
2011-04-18 00:45:53 +00:00
dholland
6a68e5d4c1 Goto still harmful, but use "goto alldone" in place of a loop break
for now anyway.
2011-04-18 00:45:29 +00:00
dholland
43ee276311 Goto considered harmful; remove dirloop: in favor of using a loop
continue.

This runs the "are we mounted?" test on every directory instead of
only sometimes; however, it's not exactly an expensive test (null
pointer check) and the prior logic wasn't exactly sensible -- it
checked at the beginning and after following a symlink but, for some
reason, not after crossing a mount point.
2011-04-18 00:45:07 +00:00
dholland
0830aae894 ISSYMLINK is now only referenced inside vfs_lookup.c, and not needed
there, so get rid of it.
2011-04-18 00:40:53 +00:00
yamt
055be2ef63 assertions 2011-04-14 15:29:25 +00:00
jakllsch
6cdca07066 Partially revert part of -r1.167; it was wrong. From dholland. 2011-04-11 18:24:49 +00:00
dholland
72609d02be description:
Update comments.
2011-04-11 02:21:17 +00:00
dholland
c42767c3ce Add comment warning about case with LOCKPARENT but not LOCKLEAF. bleh. 2011-04-11 02:21:01 +00:00
dholland
e502a5f31f description:
Remove dead assignment of "error" and simplify some uses of it.
2011-04-11 02:20:15 +00:00
dholland
0785731362 description:
Simplify refcount handling/cleanup in three places.
2011-04-11 02:20:00 +00:00
dholland
b15e67bc18 description:
Don't assign inside an if-expression without an explicit comparison.
2011-04-11 02:19:42 +00:00
dholland
a95d8d9bf8 description:
Assign NULL to ni_dvp immediately before error return, rather than
halfway through the logic.
2011-04-11 02:19:27 +00:00
dholland
080c50860a description:
namei_follow() randomly drops foundobj on success. Do that in the
caller instead. On the other hand, the caller was updating cn_nameptr,
and since that's closely related to the buffer manipulation in
namei_follow, do that there.
2011-04-11 02:19:11 +00:00
dholland
13b0ba61c9 description:
Update some comments.
2011-04-11 02:18:20 +00:00
dholland
481fee3913 description:
Don't assign ni_vp until namei_oneroot() returns.
2011-04-11 02:18:07 +00:00
dholland
1101db58b6 description:
Make sure namei_oneroot leaves ni_dvp and ni_vp NULL on error.
2011-04-11 02:17:54 +00:00
dholland
40026ffa1a description:
Cosmetic: names of scratch vnodes.
2011-04-11 02:17:41 +00:00
dholland
2c90c42da2 description:
Remove state->lookup_alldone. Don't need it any more; it's set
precisely when succeeding with a null result vnode and it now works to
just check for that case.

(also, when "error" is already 0 we don't need to assign another 0 to
it, even as a precaution.)
2011-04-11 02:17:28 +00:00
dholland
92d2421f6e description:
Pass foundobj to namei_follow() instead of fishing in the global state.
2011-04-11 02:17:14 +00:00
dholland
9a0bbd245c description:
Fix lookup_for_nfsd_index() -- it wasn't locking the directory it was
searching. I'm not sure if this is something I introduced or if it's
just been wrong for ages; the code path is used only for serving
index.html in WebNFS and probably just ought to be removed.
2011-04-11 02:17:01 +00:00
dholland
6207f76d3e description:
Ensure we don't leak stale pointers out in ni_dvp or ni_vp on error return.
2011-04-11 02:16:27 +00:00
dholland
77d9b86dde description:
In the test where we check if searchdir is NULL and fail if we needed
to return ni_dvp, also check if searchdir is on a different volume
from foundobj. I believe the NULL test was meant to encompass this
situation, but it definitely doesn't in some cases related to
emulroots. This appears to be a bug, and I'm pretty sure it's not one
I introduced.

(The search directory and result are on different volumes if we
crossed a mount point.)
2011-04-11 02:16:07 +00:00
dholland
59d384dbad description:
Don't assign ni_dvp until the end of namei_oneroot().
2011-04-11 02:15:54 +00:00
dholland
14eb7d8f01 description:
Improve previous by manipulating ni_dvp more intelligently.
2011-04-11 02:15:38 +00:00
dholland
b2a0943b93 description:
Don't bother conditionally doing vput(ndp->ni_dvp) where it's always null.
(and don't bother testing for null where it never is)
2011-04-11 02:15:21 +00:00
dholland
2261559e9e description:
In lookup_once(), assign newsearchdir_ret when searchdir is updated,
instead of upon return.
2011-04-11 02:15:09 +00:00
dholland
9a8d924b56 description:
vref new vnodes before vrele'ing old vnodes, just in case.
2011-04-11 02:14:57 +00:00
dholland
63328123b6 description:
state->namei_startdir has no further reason to exist.
2011-04-11 02:13:22 +00:00
dholland
dec6f9dee3 description:
namei_end() doesn't really do anything useful at this point, so get
rid of it.
2011-04-11 02:13:10 +00:00
dholland
32feec0843 description:
As ndp->ni_dvp is also assigned to the updated search dir on every
return from lookup_once(), pass it back instead and update ni_dvp in
the caller.
2011-04-11 02:12:58 +00:00
dholland
8afbcdea2f description:
lookup_once() on success always sets ni_vp to the same thing as the
returned foundobj, so do that in the caller instead.
2011-04-11 02:12:42 +00:00
dholland
8edb736bad description:
In lookup_once(), move the assignments to ni_dvp and ni_vp to just
before function return.
2011-04-11 02:11:32 +00:00
dholland
e10d3f7144 Use locals/args instead of state->dp in namei_once(). Remove
state->dp.
2011-04-11 01:40:13 +00:00
dholland
bc3fd6e03b Split the variable that replaced state->dp into two, to reflect its
actual usage.
2011-04-11 01:40:01 +00:00
dholland
a3df1e234e In namei_oneroot(), use a local in place of state->dp.
state->dp is now only used by/in lookup_once().
2011-04-11 01:39:46 +00:00
dholland
2a77039908 Improve namei_atsymlink to take the found object as an argument
instead of fetching it from the global state.
2011-04-11 01:39:28 +00:00
dholland
0f3ea0df8e Move unrelated error handling logic out of namei_parsepath. 2011-04-11 01:39:13 +00:00
dholland
33debd39c2 Move assignment of search directory from ni_dvp outside namei_follow. 2011-04-11 01:38:47 +00:00
dholland
f47ba9711d Improve namei_follow to handle the search dir as an argument instead
of in the global state.
2011-04-11 01:38:24 +00:00
dholland
9147816ce5 Improve namei_start to pass back its result instead of updating the
global state.
2011-04-11 01:38:10 +00:00
dholland
54d3dd621f Simplify. 2011-04-11 01:37:43 +00:00
dholland
bea472a444 Fold do_lookup into namei. 2011-04-11 01:37:14 +00:00
dholland
eaad94e4e9 Split TRYEMULROOT handling into its own function. 2011-04-11 01:36:59 +00:00
dholland
bd6bd58186 Cut and paste and simplify code used by the other nfsd entry point, so
it won't get in the way.
2011-04-11 01:36:28 +00:00
dholland
7f3a76e260 Merge nfsd's cut&paste copy of namei with the master one. 2011-04-11 01:35:55 +00:00