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: (52 commits)
  init: Open /dev/console from rootfs
  mqueue: fix typo "failues" -> "failures"
  mqueue: only set error codes if they are really necessary
  mqueue: simplify do_open() error handling
  mqueue: apply mathematics distributivity on mq_bytes calculation
  mqueue: remove unneeded info->messages initialization
  mqueue: fix mq_open() file descriptor leak on user-space processes
  fix race in d_splice_alias()
  set S_DEAD on unlink() and non-directory rename() victims
  vfs: add NOFOLLOW flag to umount(2)
  get rid of ->mnt_parent in tomoyo/realpath
  hppfs can use existing proc_mnt, no need for do_kern_mount() in there
  Mirror MS_KERNMOUNT in ->mnt_flags
  get rid of useless vfsmount_lock use in put_mnt_ns()
  Take vfsmount_lock to fs/internal.h
  get rid of insanity with namespace roots in tomoyo
  take check for new events in namespace (guts of mounts_poll()) to namespace.c
  Don't mess with generic_permission() under ->d_lock in hpfs
  sanitize const/signedness for udf
  nilfs: sanitize const/signedness in dealing with ->d_name.name
  ...

Fix up fairly trivial (famous last words...) conflicts in
drivers/infiniband/core/uverbs_main.c and security/tomoyo/realpath.c
  • Loading branch information
torvalds committed Mar 4, 2010
2 parents 1fae4cf + 9643f5d commit 0f2cc4e
Show file tree
Hide file tree
Showing 73 changed files with 773 additions and 1,080 deletions.
16 changes: 15 additions & 1 deletion Documentation/filesystems/sharedsubtree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,9 @@ replicas continue to be exactly same.
individual lists does not affect propagation or the way propagation
tree is modified by operations.

All vfsmounts in a peer group have the same ->mnt_master. If it is
non-NULL, they form a contiguous (ordered) segment of slave list.

A example propagation tree looks as shown in the figure below.
[ NOTE: Though it looks like a forest, if we consider all the shared
mounts as a conceptual entity called 'pnode', it becomes a tree]
Expand Down Expand Up @@ -874,8 +877,19 @@ replicas continue to be exactly same.

NOTE: The propagation tree is orthogonal to the mount tree.

8B Locking:

->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected
by namespace_sem (exclusive for modifications, shared for reading).

Normally we have ->mnt_flags modifications serialized by vfsmount_lock.
There are two exceptions: do_add_mount() and clone_mnt().
The former modifies a vfsmount that has not been visible in any shared
data structures yet.
The latter holds namespace_sem and the only references to vfsmount
are in lists that can't be traversed without namespace_sem.

8B Algorithm:
8C Algorithm:

The crux of the implementation resides in rbind/move operation.

Expand Down
42 changes: 13 additions & 29 deletions arch/s390/hypfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,46 +288,30 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = HYPFS_MAGIC;
sb->s_op = &hypfs_s_ops;
if (hypfs_parse_options(data, sb)) {
rc = -EINVAL;
goto err_alloc;
}
if (hypfs_parse_options(data, sb))
return -EINVAL;
root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
if (!root_inode) {
rc = -ENOMEM;
goto err_alloc;
}
if (!root_inode)
return -ENOMEM;
root_inode->i_op = &simple_dir_inode_operations;
root_inode->i_fop = &simple_dir_operations;
root_dentry = d_alloc_root(root_inode);
sb->s_root = root_dentry = d_alloc_root(root_inode);
if (!root_dentry) {
iput(root_inode);
rc = -ENOMEM;
goto err_alloc;
return -ENOMEM;
}
if (MACHINE_IS_VM)
rc = hypfs_vm_create_files(sb, root_dentry);
else
rc = hypfs_diag_create_files(sb, root_dentry);
if (rc)
goto err_tree;
return rc;
sbi->update_file = hypfs_create_update_file(sb, root_dentry);
if (IS_ERR(sbi->update_file)) {
rc = PTR_ERR(sbi->update_file);
goto err_tree;
}
if (IS_ERR(sbi->update_file))
return PTR_ERR(sbi->update_file);
hypfs_update_update(sb);
sb->s_root = root_dentry;
pr_info("Hypervisor filesystem mounted\n");
return 0;

err_tree:
hypfs_delete_tree(root_dentry);
d_genocide(root_dentry);
dput(root_dentry);
err_alloc:
kfree(sbi);
return rc;
}

static int hypfs_get_super(struct file_system_type *fst, int flags,
Expand All @@ -340,12 +324,12 @@ static void hypfs_kill_super(struct super_block *sb)
{
struct hypfs_sb_info *sb_info = sb->s_fs_info;

if (sb->s_root) {
if (sb->s_root)
hypfs_delete_tree(sb->s_root);
if (sb_info->update_file)
hypfs_remove(sb_info->update_file);
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
}
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
kill_litter_super(sb);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/mconsole_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void mconsole_proc(struct mc_request *req)
goto out;
}

err = may_open(&nd.path, MAY_READ, FMODE_READ);
err = may_open(&nd.path, MAY_READ, O_RDONLY);
if (result) {
mconsole_reply(req, "Failed to open file", 1, 0);
path_put(&nd.path);
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/uverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ extern struct idr ib_uverbs_srq_idr;
void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);

struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
int is_async, int *fd);
int is_async);
struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd);

void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
Expand Down
25 changes: 20 additions & 5 deletions drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,15 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,

resp.num_comp_vectors = file->device->num_comp_vectors;

filp = ib_uverbs_alloc_event_file(file, 1, &resp.async_fd);
ret = get_unused_fd();
if (ret < 0)
goto err_free;
resp.async_fd = ret;

filp = ib_uverbs_alloc_event_file(file, 1);
if (IS_ERR(filp)) {
ret = PTR_ERR(filp);
goto err_free;
goto err_fd;
}

if (copy_to_user((void __user *) (unsigned long) cmd.response,
Expand Down Expand Up @@ -332,9 +337,11 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
return in_len;

err_file:
put_unused_fd(resp.async_fd);
fput(filp);

err_fd:
put_unused_fd(resp.async_fd);

err_free:
ibdev->dealloc_ucontext(ucontext);

Expand Down Expand Up @@ -715,16 +722,24 @@ ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,
struct ib_uverbs_create_comp_channel cmd;
struct ib_uverbs_create_comp_channel_resp resp;
struct file *filp;
int ret;

if (out_len < sizeof resp)
return -ENOSPC;

if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;

filp = ib_uverbs_alloc_event_file(file, 0, &resp.fd);
if (IS_ERR(filp))
ret = get_unused_fd();
if (ret < 0)
return ret;
resp.fd = ret;

filp = ib_uverbs_alloc_event_file(file, 0);
if (IS_ERR(filp)) {
put_unused_fd(resp.fd);
return PTR_ERR(filp);
}

if (copy_to_user((void __user *) (unsigned long) cmd.response,
&resp, sizeof resp)) {
Expand Down
24 changes: 4 additions & 20 deletions drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,10 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler,
}

struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
int is_async, int *fd)
int is_async)
{
struct ib_uverbs_event_file *ev_file;
struct file *filp;
int ret;

ev_file = kmalloc(sizeof *ev_file, GFP_KERNEL);
if (!ev_file)
Expand All @@ -503,27 +502,12 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
ev_file->is_async = is_async;
ev_file->is_closed = 0;

*fd = get_unused_fd();
if (*fd < 0) {
ret = *fd;
goto err;
}

filp = anon_inode_getfile("[uverbs-event]", &uverbs_event_fops,
filp = anon_inode_getfile("[infinibandevent]", &uverbs_event_fops,
ev_file, O_RDONLY);
if (!filp) {
ret = -ENFILE;
goto err_fd;
}
if (IS_ERR(filp))
kfree(ev_file);

return filp;

err_fd:
put_unused_fd(*fd);

err:
kfree(ev_file);
return ERR_PTR(ret);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ static void invalidate_sub(struct fsg_lun *curlun)
unsigned long rc;

rc = invalidate_mapping_pages(inode->i_mapping, 0, -1);
VLDBG(curlun, "invalidate_inode_pages -> %ld\n", rc);
VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc);
}

static int do_verify(struct fsg_common *common)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/file_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ static void invalidate_sub(struct fsg_lun *curlun)
unsigned long rc;

rc = invalidate_mapping_pages(inode->i_mapping, 0, -1);
VLDBG(curlun, "invalidate_inode_pages -> %ld\n", rc);
VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc);
}

static int do_verify(struct fsg_dev *fsg)
Expand Down
7 changes: 0 additions & 7 deletions fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ do { \
current->pid, __func__, ##args); \
} while (0)

struct rehash_entry {
struct task_struct *task;
struct list_head list;
};

/* Unified info structure. This is pointed to by both the dentry and
inode structures. Each file in the filesystem has an instance of this
structure. It holds a reference to the dentry, so dentries are never
Expand All @@ -81,7 +76,6 @@ struct autofs_info {

struct list_head active;
int active_count;
struct list_head rehash_list;

struct list_head expiring;

Expand All @@ -104,7 +98,6 @@ struct autofs_info {
#define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */
#define AUTOFS_INF_MOUNTPOINT (1<<1) /* mountpoint status for direct expire */
#define AUTOFS_INF_PENDING (1<<2) /* dentry pending mount */
#define AUTOFS_INF_REHASH (1<<3) /* dentry in transit to ->lookup() */

struct autofs_wait_queue {
wait_queue_head_t queue;
Expand Down
11 changes: 4 additions & 7 deletions fs/autofs4/dev-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,9 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
goto out;
devid = new_encode_dev(path.mnt->mnt_sb->s_dev);
err = 0;
if (path.dentry->d_inode &&
path.mnt->mnt_root == path.dentry) {
if (path.mnt->mnt_root == path.dentry) {
err = 1;
magic = path.dentry->d_inode->i_sb->s_magic;
magic = path.mnt->mnt_sb->s_magic;
}
} else {
dev_t dev = sbi->sb->s_dev;
Expand All @@ -560,10 +559,8 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,

err = have_submounts(path.dentry);

if (path.mnt->mnt_mountpoint != path.mnt->mnt_root) {
if (follow_down(&path))
magic = path.mnt->mnt_sb->s_magic;
}
if (follow_down(&path))
magic = path.mnt->mnt_sb->s_magic;
}

param->ismountpoint.out.devid = devid;
Expand Down
6 changes: 1 addition & 5 deletions fs/autofs4/expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ struct dentry *autofs4_expire_direct(struct super_block *sb,
root->d_mounted--;
}
ino->flags |= AUTOFS_INF_EXPIRING;
autofs4_add_expiring(root);
init_completion(&ino->expire_complete);
spin_unlock(&sbi->fs_lock);
return root;
Expand Down Expand Up @@ -407,7 +406,6 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
expired, (int)expired->d_name.len, expired->d_name.name);
ino = autofs4_dentry_ino(expired);
ino->flags |= AUTOFS_INF_EXPIRING;
autofs4_add_expiring(expired);
init_completion(&ino->expire_complete);
spin_unlock(&sbi->fs_lock);
spin_lock(&dcache_lock);
Expand Down Expand Up @@ -435,7 +433,7 @@ int autofs4_expire_wait(struct dentry *dentry)

DPRINTK("expire done status=%d", status);

if (d_unhashed(dentry) && IS_DEADDIR(dentry->d_inode))
if (d_unhashed(dentry))
return -EAGAIN;

return status;
Expand Down Expand Up @@ -475,7 +473,6 @@ int autofs4_expire_run(struct super_block *sb,
spin_lock(&sbi->fs_lock);
ino = autofs4_dentry_ino(dentry);
ino->flags &= ~AUTOFS_INF_EXPIRING;
autofs4_del_expiring(dentry);
complete_all(&ino->expire_complete);
spin_unlock(&sbi->fs_lock);

Expand Down Expand Up @@ -506,7 +503,6 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
ino->flags &= ~AUTOFS_INF_MOUNTPOINT;
}
ino->flags &= ~AUTOFS_INF_EXPIRING;
autofs4_del_expiring(dentry);
complete_all(&ino->expire_complete);
spin_unlock(&sbi->fs_lock);
dput(dentry);
Expand Down
Loading

0 comments on commit 0f2cc4e

Please sign in to comment.