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: (22 commits)
  Fix the race between capifs remount and node creation
  Fix races around the access to ->s_options
  switch ufs directories to ufs_sync_file()
  Switch open_exec() and sys_uselib() to do_open_filp()
  Make open_exec() and sys_uselib() use may_open(), instead of duplicating its parts
  Reduce path_lookup() abuses
  Make checkpatch.pl shut up on fs/inode.c
  NULL noise in fs/super.c:kill_bdev_super()
  romfs: cleanup romfs_fs.h
  ROMFS: romfs_dev_read() error ignored
  fs: dcache fix LRU ordering
  ocfs2: Use nd_set_link().
  Fix deadlock in ipathfs ->get_sb()
  Fix a leak in failure exit in 9p ->get_sb()
  Convert obvious places to deactivate_locked_super()
  New helper: deactivate_locked_super()
  reiserfs: remove privroot hiding in lookup
  reiserfs: dont associate security.* with xattr files
  reiserfs: fixup xattr_root caching
  Always lookup priv_root on reiserfs mount and keep it
  ...
  • Loading branch information
Linus Torvalds committed May 10, 2009
2 parents f9f51cc + b0c4f32 commit 93b49d4
Show file tree
Hide file tree
Showing 44 changed files with 369 additions and 382 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static int ipathfs_fill_super(struct super_block *sb, void *data,
spin_unlock_irqrestore(&ipath_devs_lock, flags);
ret = create_device_files(sb, dd);
if (ret) {
deactivate_super(sb);
deactivate_locked_super(sb);
goto bail;
}
spin_lock_irqsave(&ipath_devs_lock, flags);
Expand Down
11 changes: 8 additions & 3 deletions drivers/isdn/capi/capifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)
}
}

kfree(s->s_options);
s->s_options = new_opt;
mutex_lock(&s->s_root->d_inode->i_mutex);

replace_mount_options(s, new_opt);
config.setuid = setuid;
config.setgid = setgid;
config.uid = uid;
config.gid = gid;
config.mode = mode;

mutex_unlock(&s->s_root->d_inode->i_mutex);

return 0;
}

Expand Down Expand Up @@ -154,13 +156,16 @@ void capifs_new_ncci(unsigned int number, dev_t device)
if (!inode)
return;
inode->i_ino = number+2;

dentry = get_node(number);

/* config contents is protected by root's i_mutex */
inode->i_uid = config.setuid ? config.uid : current_fsuid();
inode->i_gid = config.setgid ? config.gid : current_fsgid();
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
init_special_inode(inode, S_IFCHR|config.mode, device);
//inode->i_op = &capifs_file_inode_operations;

dentry = get_node(number);
if (!IS_ERR(dentry) && !dentry->d_inode)
d_instantiate(dentry, inode);
mutex_unlock(&capifs_root->d_inode->i_mutex);
Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/mtdsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,

ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (ret < 0) {
up_write(&sb->s_umount);
deactivate_super(sb);
deactivate_locked_super(sb);
return ret;
}

Expand Down
20 changes: 10 additions & 10 deletions drivers/scsi/osd/osd_uld.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,26 @@ static const struct file_operations osd_fops = {
.unlocked_ioctl = osd_uld_ioctl,
};

struct osd_dev *osduld_path_lookup(const char *path)
struct osd_dev *osduld_path_lookup(const char *name)
{
struct nameidata nd;
struct path path;
struct inode *inode;
struct cdev *cdev;
struct osd_uld_device *uninitialized_var(oud);
int error;

if (!path || !*path) {
if (!name || !*name) {
OSD_ERR("Mount with !path || !*path\n");
return ERR_PTR(-EINVAL);
}

error = path_lookup(path, LOOKUP_FOLLOW, &nd);
error = kern_path(name, LOOKUP_FOLLOW, &path);
if (error) {
OSD_ERR("path_lookup of %s faild=>%d\n", path, error);
OSD_ERR("path_lookup of %s failed=>%d\n", name, error);
return ERR_PTR(error);
}

inode = nd.path.dentry->d_inode;
inode = path.dentry->d_inode;
error = -EINVAL; /* Not the right device e.g osd_uld_device */
if (!S_ISCHR(inode->i_mode)) {
OSD_DEBUG("!S_ISCHR()\n");
Expand All @@ -202,15 +202,15 @@ struct osd_dev *osduld_path_lookup(const char *path)
cdev = inode->i_cdev;
if (!cdev) {
OSD_ERR("Before mounting an OSD Based filesystem\n");
OSD_ERR(" user-mode must open+close the %s device\n", path);
OSD_ERR(" Example: bash: echo < %s\n", path);
OSD_ERR(" user-mode must open+close the %s device\n", name);
OSD_ERR(" Example: bash: echo < %s\n", name);
goto out;
}

/* The Magic wand. Is it our char-dev */
/* TODO: Support sg devices */
if (cdev->owner != THIS_MODULE) {
OSD_ERR("Error mounting %s - is not an OSD device\n", path);
OSD_ERR("Error mounting %s - is not an OSD device\n", name);
goto out;
}

Expand All @@ -220,7 +220,7 @@ struct osd_dev *osduld_path_lookup(const char *path)
error = 0;

out:
path_put(&nd.path);
path_put(&path);
return error ? ERR_PTR(error) : &oud->od;
}
EXPORT_SYMBOL(osduld_path_lookup);
Expand Down
12 changes: 7 additions & 5 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/mount.h>
#include <linux/idr.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>

Expand Down Expand Up @@ -155,6 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,

root = d_alloc_root(inode);
if (!root) {
iput(inode);
retval = -ENOMEM;
goto release_sb;
}
Expand All @@ -173,10 +175,7 @@ P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
return 0;

release_sb:
if (sb) {
up_write(&sb->s_umount);
deactivate_super(sb);
}
deactivate_locked_super(sb);

free_stat:
kfree(st);
Expand Down Expand Up @@ -230,9 +229,12 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
static void
v9fs_umount_begin(struct super_block *sb)
{
struct v9fs_session_info *v9ses = sb->s_fs_info;
struct v9fs_session_info *v9ses;

lock_kernel();
v9ses = sb->s_fs_info;
v9fs_session_cancel(v9ses);
unlock_kernel();
}

static const struct super_operations v9fs_super_ops = {
Expand Down
3 changes: 1 addition & 2 deletions fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
kfree(new_opts);
return -EINVAL;
}
kfree(sb->s_options);
sb->s_options = new_opts;
replace_mount_options(sb, new_opts);

sbi->s_flags = mount_flags;
sbi->s_mode = mode;
Expand Down
7 changes: 3 additions & 4 deletions fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,21 +405,20 @@ static int afs_get_sb(struct file_system_type *fs_type,
sb->s_flags = flags;
ret = afs_fill_super(sb, &params);
if (ret < 0) {
up_write(&sb->s_umount);
deactivate_super(sb);
deactivate_locked_super(sb);
goto error;
}
sb->s_options = new_opts;
save_mount_options(sb, new_opts);
sb->s_flags |= MS_ACTIVE;
} else {
_debug("reuse");
kfree(new_opts);
ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
}

simple_set_mnt(mnt, sb);
afs_put_volume(params.volume);
afs_put_cell(params.cell);
kfree(new_opts);
_leave(" = 0 [%p]", sb);
return 0;

Expand Down
12 changes: 4 additions & 8 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,

if (s->s_root) {
if ((flags ^ s->s_flags) & MS_RDONLY) {
up_write(&s->s_umount);
deactivate_super(s);
deactivate_locked_super(s);
error = -EBUSY;
goto error_close_devices;
}
Expand All @@ -517,8 +516,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
error = btrfs_fill_super(s, fs_devices, data,
flags & MS_SILENT ? 1 : 0);
if (error) {
up_write(&s->s_umount);
deactivate_super(s);
deactivate_locked_super(s);
goto error_free_subvol_name;
}

Expand All @@ -535,15 +533,13 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
mutex_unlock(&s->s_root->d_inode->i_mutex);

if (IS_ERR(root)) {
up_write(&s->s_umount);
deactivate_super(s);
deactivate_locked_super(s);
error = PTR_ERR(root);
goto error_free_subvol_name;
}
if (!root->d_inode) {
dput(root);
up_write(&s->s_umount);
deactivate_super(s);
deactivate_locked_super(s);
error = -ENXIO;
goto error_free_subvol_name;
}
Expand Down
6 changes: 4 additions & 2 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/smp_lock.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
Expand Down Expand Up @@ -530,6 +531,7 @@ static void cifs_umount_begin(struct super_block *sb)
if (tcon == NULL)
return;

lock_kernel();
read_lock(&cifs_tcp_ses_lock);
if (tcon->tc_count == 1)
tcon->tidStatus = CifsExiting;
Expand All @@ -548,6 +550,7 @@ static void cifs_umount_begin(struct super_block *sb)
}
/* BB FIXME - finish add checks for tidStatus BB */

unlock_kernel();
return;
}

Expand Down Expand Up @@ -599,8 +602,7 @@ cifs_get_sb(struct file_system_type *fs_type,

rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0);
if (rc) {
up_write(&sb->s_umount);
deactivate_super(sb);
deactivate_locked_super(sb);
return rc;
}
sb->s_flags |= MS_ACTIVE;
Expand Down
2 changes: 1 addition & 1 deletion fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void __shrink_dcache_sb(struct super_block *sb, int *count, int flags)
if ((flags & DCACHE_REFERENCED)
&& (dentry->d_flags & DCACHE_REFERENCED)) {
dentry->d_flags &= ~DCACHE_REFERENCED;
list_move_tail(&dentry->d_lru, &referenced);
list_move(&dentry->d_lru, &referenced);
spin_unlock(&dentry->d_lock);
} else {
list_move_tail(&dentry->d_lru, &tmp);
Expand Down
5 changes: 2 additions & 3 deletions fs/devpts/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,10 @@ static int devpts_get_sb(struct file_system_type *fs_type,
return 0;

out_dput:
dput(s->s_root);
dput(s->s_root); /* undo dget() in simple_set_mnt() */

out_undo_sget:
up_write(&s->s_umount);
deactivate_super(s);
deactivate_locked_super(s);
return error;
}

Expand Down
5 changes: 2 additions & 3 deletions fs/ecryptfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,8 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
}
goto out;
out_abort:
dput(sb->s_root);
up_write(&sb->s_umount);
deactivate_super(sb);
dput(sb->s_root); /* aka mnt->mnt_root, as set by get_sb_nodev() */
deactivate_locked_super(sb);
out:
return rc;
}
Expand Down
Loading

0 comments on commit 93b49d4

Please sign in to comment.