Commit Graph

203 Commits

Author SHA1 Message Date
pooka
d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
riastradh
e6d0ae95b0 Cull unused INRENAME and INRELOOKUP from callers. 2015-04-21 03:19:03 +00:00
hannken
97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
manu
a76c1cc17f Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
2012-11-18 17:41:51 +00:00
para
ab1daf988f make DEBUG kernels buildable again (typo) 2012-11-05 21:35:28 +00:00
dholland
b496a9dc26 Rename the new ni_startdir (the slot used to hold the starting point
for openat() and friends) to ni_atdir to avoid confusion with a
previously existing (and, alas, still documented) ni_startdir field
that meant something else entirely.
2012-11-05 19:06:26 +00:00
dholland
1617a81dd1 Disentangle the namecache from the internals of namei.
- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

 - It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

 - Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
2012-11-05 17:24:09 +00:00
dholland
ebc30f9e8b Replace hack implementation of NDAT() for "nameiat" with a proper one.
(This change requires a kernel bump.)
2012-10-13 17:46:50 +00:00
dholland
03f1fbd862 In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.

In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.

(in theory both of these fixes are not required together)

Should fix PR 47040.
2012-10-10 06:55:25 +00:00
dholland
4fc6b20089 Add namei-level support for openat() and friends. The way you do it is
by calling NDAT(&nd, dirvp) after NDINIT().

Right now the implementation is vile and unspeakable to avoid changing
the kernel ABI; this way we can get openat() and friends into 6.1. I
will rectify the mess and bump the kernel once things are working.
2012-10-08 23:43:33 +00:00
dholland
eee667d033 Tidy up namei internals to allow openat() and friends without getting
tangled in nfsd's special cases.
2012-10-08 23:41:39 +00:00
christos
6c3622d61d include <sys/dirent.h> to make MAXNAMLEN visible. 2011-09-27 02:10:55 +00:00
christos
81de71ae58 use KERNEL_NAME_MAX to enforce the same limit to names as before, and
make sure that MAXNAMLEN == NAME_MAX
2011-09-27 01:42:45 +00:00
yamt
acf0c89366 redo vfs_lookup.c rev.1.126.
when crossing a mount point, don't keep the parent vnode locked.
ie. don't lock a vnode while holding another vnode which belongs to a
different filesystem.  otherwise we propagate slowness (or deadness) of a
filesystem to another via vnode lock chain.
2011-09-01 15:31:27 +00:00
riastradh
f9b524691c Handle absolute symlinks to the root.
Fixes panic on `ln -s / foo && cd foo' found by ober by trying to run
wine.

ok dholland
2011-08-13 19:40:02 +00:00
dholland
8225acd644 Revert previous, it breaks nullfs. (And I guess there are no tests for
nullfs?)
2011-08-10 05:42:32 +00:00
dholland
9c377dcfe1 Fail namei immediately if searchdir is unlinked / has been rmdir'd.
Do this by checking if v_size == 0. Should fix PR 44658 (and PR 32661).
2011-08-09 23:46:05 +00:00
dholland
8d4d585132 Include missing part of previous commit to this file. (sigh) 2011-08-09 23:16:17 +00:00
dholland
943b2f8eb3 Simplify handling of slashes. Provides a proper fix for PR 44961. 2011-08-09 18:37:56 +00:00
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