Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits)
  [PATCH] fs: add a sanity check in d_free
  [PATCH] i_version: remount support
  [patch] vfs: make security_inode_setattr() calling consistent
  [patch 1/3] FS_MBCACHE: don't needlessly make it built-in
  [PATCH] move executable checking into ->permission()
  [PATCH] fs/dcache.c: update comment of d_validate()
  [RFC PATCH] touch_mnt_namespace when the mount flags change
  [PATCH] reiserfs: add missing llseek method
  [PATCH] fix ->llseek for more directories
  [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent
  [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup
  [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate()
  [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper
  [PATCH vfs-2.6 2/6] vfs: add d_ancestor()
  [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT()
  [PATCH] get rid of on-stack dentry in udf
  [PATCH 2/2] anondev: switch to IDA
  [PATCH 1/2] anondev: init IDR statically
  [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup()
  [PATCH] Optimise NFS readdir hack slightly.
  ...
  • Loading branch information
torvalds committed Oct 23, 2008
2 parents 5b34653 + fd217f4 commit 5ed487b
Show file tree
Hide file tree
Showing 76 changed files with 883 additions and 1,133 deletions.
7 changes: 2 additions & 5 deletions arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,11 @@ osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent,
buf.error = 0;

error = vfs_readdir(file, osf_filldir, &buf);
if (error < 0)
goto out_putf;

error = buf.error;
if (error >= 0)
error = buf.error;
if (count != buf.count)
error = count - buf.count;

out_putf:
fput(file);
out:
return error;
Expand Down
5 changes: 2 additions & 3 deletions arch/parisc/hpux/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i
buf.error = 0;

error = vfs_readdir(file, filldir, &buf);
if (error < 0)
goto out_putf;
error = buf.error;
if (error >= 0)
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
if (put_user(file->f_pos, &lastdirent->d_off))
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/cell/spufs/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
if (!IS_ERR(tmp)) {
struct nameidata nd;

ret = path_lookup(tmp, LOOKUP_PARENT|
LOOKUP_OPEN|LOOKUP_CREATE, &nd);
ret = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (!ret) {
nd.flags |= LOOKUP_OPEN | LOOKUP_CREATE;
ret = spufs_create(&nd, flags, mode, neighbor);
path_put(&nd.path);
}
Expand Down
21 changes: 6 additions & 15 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,6 @@ static inline int check_space(struct dm_table *t)
return 0;
}

/*
* Convert a device path to a dev_t.
*/
static int lookup_device(const char *path, dev_t *dev)
{
struct block_device *bdev = lookup_bdev(path);
if (IS_ERR(bdev))
return PTR_ERR(bdev);
*dev = bdev->bd_dev;
bdput(bdev);
return 0;
}

/*
* See if we've already got a device in the list.
*/
Expand Down Expand Up @@ -437,8 +424,12 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
return -EOVERFLOW;
} else {
/* convert the path to a device */
if ((r = lookup_device(path, &dev)))
return r;
struct block_device *bdev = lookup_bdev(path);

if (IS_ERR(bdev))
return PTR_ERR(bdev);
dev = bdev->bd_dev;
bdput(bdev);
}

dd = find_device(&t->devices, dev);
Expand Down
7 changes: 4 additions & 3 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ source "fs/jbd2/Kconfig"
config FS_MBCACHE
# Meta block cache for Extended Attributes (ext2/ext3/ext4)
tristate
depends on EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4_FS_XATTR
default y if EXT2_FS=y || EXT3_FS=y || EXT4_FS=y
default m if EXT2_FS=m || EXT3_FS=m || EXT4_FS=m
default y if EXT2_FS=y && EXT2_FS_XATTR
default y if EXT3_FS=y && EXT3_FS_XATTR
default y if EXT4_FS=y && EXT4_FS_XATTR
default m if EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4_FS_XATTR

config REISERFS_FS
tristate "Reiserfs support"
Expand Down
1 change: 1 addition & 0 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const struct file_operations afs_dir_file_operations = {
.release = afs_release,
.readdir = afs_readdir,
.lock = afs_lock,
.llseek = generic_file_llseek,
};

const struct inode_operations afs_dir_inode_operations = {
Expand Down
10 changes: 5 additions & 5 deletions fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
if (!(attr->ia_valid & ~(ATTR_KILL_SUID | ATTR_KILL_SGID)))
return 0;

error = security_inode_setattr(dentry, attr);
if (error)
return error;

if (ia_valid & ATTR_SIZE)
down_write(&dentry->d_inode->i_alloc_sem);

if (inode->i_op && inode->i_op->setattr) {
error = security_inode_setattr(dentry, attr);
if (!error)
error = inode->i_op->setattr(dentry, attr);
error = inode->i_op->setattr(dentry, attr);
} else {
error = inode_change_ok(inode, attr);
if (!error)
error = security_inode_setattr(dentry, attr);
if (!error) {
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
Expand Down
1 change: 1 addition & 0 deletions fs/bfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const struct file_operations bfs_dir_operations = {
.read = generic_read_dir,
.readdir = bfs_readdir,
.fsync = file_fsync,
.llseek = generic_file_llseek,
};

extern void dump_imap(const char *, struct super_block *);
Expand Down
14 changes: 7 additions & 7 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,33 +1268,33 @@ EXPORT_SYMBOL(ioctl_by_bdev);
* namespace if possible and return it. Return ERR_PTR(error)
* otherwise.
*/
struct block_device *lookup_bdev(const char *path)
struct block_device *lookup_bdev(const char *pathname)
{
struct block_device *bdev;
struct inode *inode;
struct nameidata nd;
struct path path;
int error;

if (!path || !*path)
if (!pathname || !*pathname)
return ERR_PTR(-EINVAL);

error = path_lookup(path, LOOKUP_FOLLOW, &nd);
error = kern_path(pathname, LOOKUP_FOLLOW, &path);
if (error)
return ERR_PTR(error);

inode = nd.path.dentry->d_inode;
inode = path.dentry->d_inode;
error = -ENOTBLK;
if (!S_ISBLK(inode->i_mode))
goto fail;
error = -EACCES;
if (nd.path.mnt->mnt_flags & MNT_NODEV)
if (path.mnt->mnt_flags & MNT_NODEV)
goto fail;
error = -ENOMEM;
bdev = bd_acquire(inode);
if (!bdev)
goto fail;
out:
path_put(&nd.path);
path_put(&path);
return bdev;
fail:
bdev = ERR_PTR(error);
Expand Down
21 changes: 14 additions & 7 deletions fs/char_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,22 @@ static int chrdev_open(struct inode *inode, struct file *filp)
cdev_put(new);
if (ret)
return ret;

ret = -ENXIO;
filp->f_op = fops_get(p->ops);
if (!filp->f_op) {
cdev_put(p);
return -ENXIO;
}
if (filp->f_op->open)
if (!filp->f_op)
goto out_cdev_put;

if (filp->f_op->open) {
ret = filp->f_op->open(inode,filp);
if (ret)
cdev_put(p);
if (ret)
goto out_cdev_put;
}

return 0;

out_cdev_put:
cdev_put(p);
return ret;
}

Expand Down
10 changes: 7 additions & 3 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,12 @@ static int cifs_permission(struct inode *inode, int mask)

cifs_sb = CIFS_SB(inode->i_sb);

if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
return 0;
else /* file mode might have been restricted at mount time
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
if ((mask & MAY_EXEC) && !execute_ok(inode))
return -EACCES;
else
return 0;
} else /* file mode might have been restricted at mount time
on the client (above and beyond ACL on servers) for
servers which do not support setting and viewing mode bits,
so allowing client to check permissions is useful */
Expand Down Expand Up @@ -765,6 +768,7 @@ const struct file_operations cifs_dir_ops = {
.dir_notify = cifs_dir_notify,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
.unlocked_ioctl = cifs_ioctl,
.llseek = generic_file_llseek,
};

static void
Expand Down
3 changes: 3 additions & 0 deletions fs/coda/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ int coda_permission(struct inode *inode, int mask)
if (!mask)
return 0;

if ((mask & MAY_EXEC) && !execute_ok(inode))
return -EACCES;

lock_kernel();

if (coda_cache_check(inode, mask))
Expand Down
2 changes: 1 addition & 1 deletion fs/coda/pioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const struct file_operations coda_ioctl_operations = {
/* the coda pioctl inode ops */
static int coda_ioctl_permission(struct inode *inode, int mask)
{
return 0;
return (mask & MAY_EXEC) ? -EACCES : 0;
}

static int coda_pioctl(struct inode * inode, struct file * filp,
Expand Down
22 changes: 8 additions & 14 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
buf.dirent = dirent;

error = vfs_readdir(file, compat_fillonedir, &buf);
if (error >= 0)
if (buf.result)
error = buf.result;

fput(file);
Expand Down Expand Up @@ -956,18 +956,15 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
buf.error = 0;

error = vfs_readdir(file, compat_filldir, &buf);
if (error < 0)
goto out_putf;
error = buf.error;
if (error >= 0)
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
if (put_user(file->f_pos, &lastdirent->d_off))
error = -EFAULT;
else
error = count - buf.count;
}

out_putf:
fput(file);
out:
return error;
Expand Down Expand Up @@ -1047,19 +1044,16 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
buf.error = 0;

error = vfs_readdir(file, compat_filldir64, &buf);
if (error < 0)
goto out_putf;
error = buf.error;
if (error >= 0)
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
typeof(lastdirent->d_off) d_off = file->f_pos;
error = -EFAULT;
if (__put_user_unaligned(d_off, &lastdirent->d_off))
goto out_putf;
error = count - buf.count;
error = -EFAULT;
else
error = count - buf.count;
}

out_putf:
fput(file);
out:
return error;
Expand Down
16 changes: 8 additions & 8 deletions fs/configfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ static int create_link(struct config_item *parent_item,
}


static int get_target(const char *symname, struct nameidata *nd,
static int get_target(const char *symname, struct path *path,
struct config_item **target)
{
int ret;

ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd);
ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path);
if (!ret) {
if (nd->path.dentry->d_sb == configfs_sb) {
*target = configfs_get_config_item(nd->path.dentry);
if (path->dentry->d_sb == configfs_sb) {
*target = configfs_get_config_item(path->dentry);
if (!*target) {
ret = -ENOENT;
path_put(&nd->path);
path_put(path);
}
} else
ret = -EPERM;
Expand All @@ -132,7 +132,7 @@ static int get_target(const char *symname, struct nameidata *nd,
int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
{
int ret;
struct nameidata nd;
struct path path;
struct configfs_dirent *sd;
struct config_item *parent_item;
struct config_item *target_item;
Expand All @@ -159,7 +159,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
!type->ct_item_ops->allow_link)
goto out_put;

ret = get_target(symname, &nd, &target_item);
ret = get_target(symname, &path, &target_item);
if (ret)
goto out_put;

Expand All @@ -174,7 +174,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
}

config_item_put(target_item);
path_put(&nd.path);
path_put(&path);

out_put:
config_item_put(parent_item);
Expand Down
Loading

0 comments on commit 5ed487b

Please sign in to comment.