summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-03-27convert hfsAl Viro1-26/+23
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert befsAl Viro1-18/+22
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert cifsAl Viro3-100/+82
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert freevxfsAl Viro1-32/+23
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert fuseAl Viro1-20/+17
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert hpfsAl Viro1-27/+29
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27reiserfs: switch reiserfs_readdir_dentry to inodeAl Viro3-17/+15
... and clean the callers up a bit Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27reiserfs: is_privroot_deh() needs only directory inode, actuallyAl Viro1-5/+4
... and that - only to get the superblock. Privroot is a directory and we don't allow hardlinks to those... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert reiserfsAl Viro3-23/+19
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert ntfsAl Viro1-57/+27
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert isofsAl Viro1-22/+20
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert jffs2Al Viro1-36/+16
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert f2fsAl Viro2-35/+22
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert 9pAl Viro1-44/+28
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert affsAl Viro1-45/+24
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert adfsAl Viro1-24/+18
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert logfsAl Viro1-34/+15
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert jfsAl Viro3-39/+33
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert cephAl Viro1-51/+48
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert nfsAl Viro1-26/+25
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert ext4Al Viro3-190/+134
and trim the living hell out bogosities in inline dir case Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert qnx6Al Viro1-17/+14
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert qnx4Al Viro1-35/+31
... and use strnlen() instead of strlen() - it's done on untrusted data, after all. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert omfsAl Viro1-56/+38
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert nilfs2Al Viro1-30/+18
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert sysfsAl Viro1-49/+19
get rid of the kludges in sysfs_readdir() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert gfs2Al Viro4-51/+38
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert exofsAl Viro1-22/+16
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert bfsAl Viro1-21/+14
... and get rid of that ridiculous mutex in bfs_readdir() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert procfsAl Viro9-489/+284
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert openpromfsAl Viro1-51/+44
what the hell is op_mutex for, BTW? Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert efsAl Viro1-42/+33
* sanity checks belong before risky operation, not after it * don't quit as soon as we'd found an entry Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert configfsAl Viro1-70/+52
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert romfsAl Viro1-12/+9
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert squashfsAl Viro1-28/+12
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert ubifsAl Viro1-41/+16
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert udfAl Viro1-37/+26
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27convert ext3Al Viro2-93/+70
new helper: dir_relax(inode). Call when you are in location that will _not_ be invalidated by directory modifications (block boundary, in case of ext*). Returns whether the directory has survived (dropping i_mutex allows rmdir to kill the sucker; if it returns false to us, ->iterate() is obviously done) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27switch dcache_readdir() users to ->iterate()Al Viro4-60/+65
new helpers - dir_emit_dot(file, ctx, dentry), dir_emit_dotdot(file, ctx), dir_emit_dots(file, ctx). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27simple local unixlike: switch to ->iterate()Al Viro4-75/+59
ext2, ufs, minix, sysv Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27introduce ->iterate(), ctx->pos, dir_emit()Al Viro7-18/+47
New method - ->iterate(file, ctx). That's the replacement for ->readdir(); it takes callback from ctx->actor, uses ctx->pos instead of file->f_pos and calls dir_emit(ctx, ...) instead of filldir(data, ...). It does *not* update file->f_pos (or look at it, for that matter); iterate_dir() does the update. Note that dir_emit() takes the offset from ctx->pos (and eventually filldir_t will lose that argument). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-27introduce iterate_dir() and dir_contextAl Viro10-20/+53
iterate_dir(): new helper, replacing vfs_readdir(). struct dir_context: contains the readdir callback (and will get more stuff in it), embedded into whatever data that callback wants to deal with; eventually, we'll be passing it to ->readdir() replacement instead of (data,filldir) pair. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-03-23sysfs: remove ktype->namespace() invocations in symlink codeTejun Heo3-16/+24
There's no reason for sysfs to be calling ktype->namespace(). It is backwards, obfuscates what's going on and unnecessarily tangles two separate layers. There are two places where symlink code calls ktype->namespace(). * sysfs_do_create_link_sd() calls it to find out the namespace tag of the target directory. Unless symlinking races with cross-namespace renaming, this equals @target_sd->s_ns. * sysfs_rename_link() uses it to find out the new namespace to rename to and the new namespace can be different from the existing one. The function is renamed to sysfs_rename_link_ns() with an explicit @ns argument and the ktype->namespace() invocation is shifted to the device layer. While this patch replaces ktype->namespace() invocation with the recorded result in @target_sd, this shouldn't result in any behvior difference. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-23sysfs: remove ktype->namespace() invocations in directory codeTejun Heo4-27/+45
For some unrecognizable reason, namespace information is communicated to sysfs through ktype->namespace() callback when there's *nothing* which needs the use of a callback. The whole sequence of operations is completely synchronous and sysfs operations simply end up calling back into the layer which just invoked it in order to find out the namespace information, which is completely backwards, obfuscates what's going on and unnecessarily tangles two separate layers. This patch doesn't remove ktype->namespace() but shifts its handling to kobject layer. We probably want to get rid of the callback in the long term. This patch adds an explicit param to sysfs_{create|rename|move}_dir() and renames them to sysfs_{create|rename|move}_dir_ns(), respectively. ktype->namespace() invocations are moved to the calling sites of the above functions. A new helper kboject_namespace() is introduced which directly tests kobj_ns_type_operations->type which should give the same result as testing sysfs_fs_type(parent_sd) and returns @kobj's namespace tag as necessary. kobject_namespace() is extern as it will be used from another file in the following patches. This patch should be an equivalent conversion without any functional difference. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-23sysfs: make attr namespace interface less convolutedTejun Heo9-129/+106
sysfs ns (namespace) implementation became more convoluted than necessary while trying to hide ns information from visible interface. The relatively recent attr ns support is a good example. * attr ns tag is determined by sysfs_ops->namespace() callback while dir tag is determined by kobj_type->namespace(). The placement is arbitrary. * Instead of performing operations with explicit ns tag, the namespace callback is routed through sysfs_attr_ns(), sysfs_ops->namespace(), class_attr_namespace(), class_attr->namespace(). It's not simpler in any sense. The only thing this convolution does is traversing the whole stack backwards. The namespace callbacks are unncessary because the operations involved are inherently synchronous. The information can be provided in in straight-forward top-down direction and reversing that direction is unnecessary and against basic design principles. This backward interface is unnecessarily convoluted and hinders properly separating out sysfs from driver model / kobject for proper layering. This patch updates attr ns support such that * sysfs_ops->namespace() and class_attr->namespace() are dropped. * sysfs_{create|remove}_file_ns(), which take explicit @ns param, are added and sysfs_{create|remove}_file() are now simple wrappers around the ns aware functions. * ns handling is dropped from sysfs_chmod_file(). Nobody uses it at this point. sysfs_chmod_file_ns() can be added later if necessary. * Explicit @ns is propagated through class_{create|remove}_file_ns() and netdev_class_{create|remove}_file_ns(). * driver/net/bonding which is currently the only user of attr namespace is updated to use netdev_class_{create|remove}_file_ns() with @bh->net as the ns tag instead of using the namespace callback. This patch should be an equivalent conversion without any functional difference. It makes the code easier to follow, reduces lines of code a bit and helps proper separation and layering. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-23sysfs: drop semicolon from to_sysfs_dirent() definitionTejun Heo1-1/+1
The expansion of to_sysfs_dirent() contains an unncessary trailing semicolon making it impossible to use in the middle of statements. Drop it. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-23sysfs: Restrict mounting sysfsEric W. Biederman4-3/+34
Don't allow mounting sysfs unless the caller has CAP_SYS_ADMIN rights over the net namespace. The principle here is if you create or have capabilities over it you can mount it, otherwise you get to live with what other people have mounted. Instead of testing this with a straight forward ns_capable call, perform this check the long and torturous way with kobject helpers, this keeps direct knowledge of namespaces out of sysfs, and preserves the existing sysfs abstractions. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2015-03-23userns: Better restrictions on when proc and sysfs can be mountedEric W. Biederman7-23/+33
Rely on the fact that another flavor of the filesystem is already mounted and do not rely on state in the user namespace. Verify that the mounted filesystem is not covered in any significant way. I would love to verify that the previously mounted filesystem has no mounts on top but there are at least the directories /proc/sys/fs/binfmt_misc and /sys/fs/cgroup/ that exist explicitly for other filesystems to mount on top of. Refactor the test into a function named fs_fully_visible and call that function from the mount routines of proc and sysfs. This makes this test local to the filesystems involved and the results current of when the mounts take place, removing a weird threading of the user namespace, the mount namespace and the filesystems themselves. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2015-03-23sysfs: file.c: fix up broken string warningsGreg Kroah-Hartman1-4/+6
This fixes the coding style warnings in fs/sysfs/file.c for broken strings across lines. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-23sysfs: fix up uaccess.h coding style warningsGreg Kroah-Hartman2-3/+2
This fixes the uaccess.h warnings in the sysfs.c files. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>