Al Viro
a9049376ee
make d_splice_alias(ERR_PTR(err), dentry) = ERR_PTR(err)
...
... and simplify the living hell out of callers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:26 -04:00
Al Viro
0c1aa9a952
deuglify squashfs_lookup()
...
d_splice_alias(NULL, dentry) is equivalent to d_add(dentry, NULL), NULL
so no need for that if (inode) ... in there (or ERR_PTR(0), for that
matter)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:24 -04:00
Al Viro
5b4b299cc7
nfsd4_list_rec_dir(): don't bother with reopening rec_file
...
just rewind it to the beginning before vfs_readdir() and be
done with that...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:23 -04:00
Al Viro
e7f5909707
kill useless checks for sb->s_op == NULL
...
never is...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:21 -04:00
Al Viro
0ee5dc676a
btrfs: kill magical embedded struct superblock
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:20 -04:00
Al Viro
fb408e6ccc
get rid of pointless checks for dentry->sb == NULL
...
it never is...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:19 -04:00
Al Viro
a4464dbc0c
Make ->d_sb assign-once and always non-NULL
...
New helper (non-exported, fs/internal.h-only): __d_alloc(sb, name).
Allocates dentry, sets its ->d_sb to given superblock and sets
->d_op accordingly. Old d_alloc(NULL, name) callers are converted
to that (all of them know what superblock they want). d_alloc()
itself is left only for parent != NULl case; uses __d_alloc(),
inserts result into the list of parent's children.
Note that now ->d_sb is assign-once and never NULL *and*
->d_parent is never NULL either.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:17 -04:00
Al Viro
e3c3d9c838
unexport kern_path_parent()
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:16 -04:00
Al Viro
e0a0124936
switch vfs_path_lookup() to struct path
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:14 -04:00
Al Viro
ed75e95de5
kill lookup_create()
...
folded into the only caller (kern_path_create())
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:12 -04:00
Al Viro
5da4e68944
devtmpfs: get rid of bogus mkdir in create_path()
...
We do _NOT_ want to mkdir the path itself - we are preparing to
mknod it, after all. Normally it'll fail with -ENOENT and
just do nothing, but if somebody has created the parent in
the meanwhile, we'll get buggered...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:11 -04:00
Al Viro
69753a0f14
switch devtmpfs to kern_path_create()
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:10 -04:00
Al Viro
2780f1ff6a
switch devtmpfs object creation/removal to separate kernel thread
...
... and give it a namespace where devtmpfs would be mounted on root,
thus avoiding abuses of vfs_path_lookup() (it was never intended to
be used with LOOKUP_PARENT). Games with credentials are also gone.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:09 -04:00
Al Viro
6657719390
make sure that nsproxy_cache is initialized early enough
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:07 -04:00
Al Viro
1ba1068186
switch do_spufs_create() to user_path_create(), fix double-unlock
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:06 -04:00
Al Viro
dae6ad8f37
new helpers: kern_path_create/user_path_create
...
combination of kern_path_parent() and lookup_create(). Does *not*
expose struct nameidata to caller. Syscalls converted to that...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:05 -04:00
Al Viro
49084c3bb2
kill LOOKUP_CONTINUE
...
LOOKUP_PARENT is equivalent to it now
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:03 -04:00
Al Viro
8aeb376ca0
nfs: LOOKUP_{OPEN,CREATE,EXCL} is set only on the last step
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:02 -04:00
Al Viro
4352780386
cifs_lookup(): LOOKUP_OPEN is set only on the last component
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:44:00 -04:00
Al Viro
a127e0af59
ceph: LOOKUP_OPEN is set only when it's the last component
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:59 -04:00
Al Viro
5c0f360b08
jfs_ci_revalidate() is safe from RCU mode
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:57 -04:00
Al Viro
407938e79e
LOOKUP_CREATE and LOOKUP_RENAME_TARGET can be set only on the last step
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:56 -04:00
Al Viro
dd7dd556e4
no need to check for LOOKUP_OPEN in ->create() instances
...
... it will be set in nd->flag for all cases with non-NULL nd
(i.e. when called from do_last()).
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:56 -04:00
Al Viro
bf6c7f6c7b
don't pass nameidata to vfs_create() from ecryptfs_create()
...
Instead of playing with removal of LOOKUP_OPEN, mangling (and
restoring) nd->path, just pass NULL to vfs_create(). The whole
point of what's being done there is to suppress any attempts
to open file by underlying fs, which is what nd == NULL indicates.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:54 -04:00
Al Viro
8a5e929dd2
don't transliterate lower bits of ->intent.open.flags to FMODE_...
...
->create() instances are much happier that way...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:52 -04:00
Al Viro
554a8b9f54
Don't pass nameidata when calling vfs_create() from mknod()
...
All instances can cope with that now (and ceph one actually
starts working properly).
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:49 -04:00
Al Viro
f7c85868fc
fix mknod() on nfs4 (hopefully)
...
a) check the right flags in ->create() (LOOKUP_OPEN, not LOOKUP_CREATE)
b) default (!LOOKUP_OPEN) open_flags is O_CREAT|O_EXCL|FMODE_READ, not 0
c) lookup_instantiate_filp() should be done only with LOOKUP_OPEN;
otherwise we need to issue CLOSE, lest we leak stateid on server.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:46 -04:00
Al Viro
511415980a
nameidata_to_nfs_open_context() doesn't need nameidata, actually...
...
just open flags; switched to passing just those and
renamed to create_nfs_open_context()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:45 -04:00
Al Viro
3d4ff43d89
nfs_open_context doesn't need struct path either
...
just dentry, please...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:44 -04:00
Al Viro
82a2c1b77a
nfs4_opendata doesn't need struct path either
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:42 -04:00
Al Viro
643168c2dc
nfs4_closedata doesn't need to mess with struct path
...
instead of path_get()/path_put(), we can just use nfs_sb_{,de}active()
to pin the superblock down.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:41 -04:00
Al Viro
7c97c200e2
cifs: fix the type of cifs_demultiplex_thread()
...
... and get rid of a bogus typecast, while we are at it; it's not
just that we want a function returning int and not void, but cast
to pointer to function taking void * and returning void would be
(void (*)(void *)) and not (void *)(void *), TYVM...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:39 -04:00
Al Viro
beefebf1aa
ecryptfs_inode_permission() doesn't need to bail out on RCU
...
... now that inode_permission() can take MAY_NOT_BLOCK and handle it
properly.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:38 -04:00
Al Viro
729cdb3a1e
kill IPERM_FLAG_RCU
...
not used anymore
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:36 -04:00
Al Viro
76fe3276be
->permission() sanitizing: document API changes
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:36 -04:00
Al Viro
d2d9e9fbc2
merge do_revalidate() into its only caller
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:34 -04:00
Al Viro
4ad5abb3d0
no reason to keep exec_permission() separate now
...
cache footprint alone makes it a bad idea...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:32 -04:00
Al Viro
d594e7ec4d
massage generic_permission() to treat directories on a separate path
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:30 -04:00
Al Viro
eecdd358b4
->permission() sanitizing: don't pass flags to exec_permission()
...
pass mask instead; kill security_inode_exec_permission() since we can use
security_inode_permission() instead.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:29 -04:00
Al Viro
cf1dd1dae8
selinux: don't transliterate MAY_NOT_BLOCK to IPERM_FLAG_RCU
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:27 -04:00
Al Viro
e74f71eb78
->permission() sanitizing: don't pass flags to ->inode_permission()
...
pass that via mask instead.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:26 -04:00
Al Viro
10556cb21a
->permission() sanitizing: don't pass flags to ->permission()
...
not used by the instances anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:24 -04:00
Al Viro
2830ba7f34
->permission() sanitizing: don't pass flags to generic_permission()
...
redundant; all callers get it duplicated in mask & MAY_NOT_BLOCK and none of
them removes that bit.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:22 -04:00
Al Viro
7e40145eb1
->permission() sanitizing: don't pass flags to ->check_acl()
...
not used in the instances anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:21 -04:00
Al Viro
9c2c703929
->permission() sanitizing: pass MAY_NOT_BLOCK to ->check_acl()
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:19 -04:00
Al Viro
1fc0f78ca9
->permission() sanitizing: MAY_NOT_BLOCK
...
Duplicate the flags argument into mask bitmap.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:18 -04:00
Al Viro
178ea73521
kill check_acl callback of generic_permission()
...
its value depends only on inode and does not change; we might as
well store it in ->i_op->check_acl and be done with that.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:16 -04:00
Al Viro
07b8ce1ee8
lockless get_write_access/deny_write_access
...
new helpers: atomic_inc_unless_negative()/atomic_dec_unless_positive()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:14 -04:00
Al Viro
f4d6ff89d8
move exec_permission() up to the rest of permission-related functions
...
... and convert the comment before it into linuxdoc form.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:13 -04:00
Al Viro
3bfa784a65
kill file_permission() completely
...
convert the last remaining caller to inode_permission()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-20 01:43:11 -04:00