diff options
44 files changed, 369 insertions, 382 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 8dc2bb781605..b3684060465e 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
| @@ -347,7 +347,7 @@ static int ipathfs_fill_super(struct super_block *sb, void *data, | |||
| 347 | spin_unlock_irqrestore(&ipath_devs_lock, flags); | 347 | spin_unlock_irqrestore(&ipath_devs_lock, flags); |
| 348 | ret = create_device_files(sb, dd); | 348 | ret = create_device_files(sb, dd); |
| 349 | if (ret) { | 349 | if (ret) { |
| 350 | deactivate_super(sb); | 350 | deactivate_locked_super(sb); |
| 351 | goto bail; | 351 | goto bail; |
| 352 | } | 352 | } |
| 353 | spin_lock_irqsave(&ipath_devs_lock, flags); | 353 | spin_lock_irqsave(&ipath_devs_lock, flags); |
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index b129409925af..bff72d81f263 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
| @@ -75,15 +75,17 @@ static int capifs_remount(struct super_block *s, int *flags, char *data) | |||
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | kfree(s->s_options); | 78 | mutex_lock(&s->s_root->d_inode->i_mutex); |
| 79 | s->s_options = new_opt; | ||
| 80 | 79 | ||
| 80 | replace_mount_options(s, new_opt); | ||
| 81 | config.setuid = setuid; | 81 | config.setuid = setuid; |
| 82 | config.setgid = setgid; | 82 | config.setgid = setgid; |
| 83 | config.uid = uid; | 83 | config.uid = uid; |
| 84 | config.gid = gid; | 84 | config.gid = gid; |
| 85 | config.mode = mode; | 85 | config.mode = mode; |
| 86 | 86 | ||
| 87 | mutex_unlock(&s->s_root->d_inode->i_mutex); | ||
| 88 | |||
| 87 | return 0; | 89 | return 0; |
| 88 | } | 90 | } |
| 89 | 91 | ||
| @@ -154,13 +156,16 @@ void capifs_new_ncci(unsigned int number, dev_t device) | |||
| 154 | if (!inode) | 156 | if (!inode) |
| 155 | return; | 157 | return; |
| 156 | inode->i_ino = number+2; | 158 | inode->i_ino = number+2; |
| 159 | |||
| 160 | dentry = get_node(number); | ||
| 161 | |||
| 162 | /* config contents is protected by root's i_mutex */ | ||
| 157 | inode->i_uid = config.setuid ? config.uid : current_fsuid(); | 163 | inode->i_uid = config.setuid ? config.uid : current_fsuid(); |
| 158 | inode->i_gid = config.setgid ? config.gid : current_fsgid(); | 164 | inode->i_gid = config.setgid ? config.gid : current_fsgid(); |
| 159 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 165 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
| 160 | init_special_inode(inode, S_IFCHR|config.mode, device); | 166 | init_special_inode(inode, S_IFCHR|config.mode, device); |
| 161 | //inode->i_op = &capifs_file_inode_operations; | 167 | //inode->i_op = &capifs_file_inode_operations; |
| 162 | 168 | ||
| 163 | dentry = get_node(number); | ||
| 164 | if (!IS_ERR(dentry) && !dentry->d_inode) | 169 | if (!IS_ERR(dentry) && !dentry->d_inode) |
| 165 | d_instantiate(dentry, inode); | 170 | d_instantiate(dentry, inode); |
| 166 | mutex_unlock(&capifs_root->d_inode->i_mutex); | 171 | mutex_unlock(&capifs_root->d_inode->i_mutex); |
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index 92285d0089c2..af8b42e0a55b 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c | |||
| @@ -74,8 +74,7 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, | |||
| 74 | 74 | ||
| 75 | ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 75 | ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
| 76 | if (ret < 0) { | 76 | if (ret < 0) { |
| 77 | up_write(&sb->s_umount); | 77 | deactivate_locked_super(sb); |
| 78 | deactivate_super(sb); | ||
| 79 | return ret; | 78 | return ret; |
| 80 | } | 79 | } |
| 81 | 80 | ||
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index f644c9571eab..22b59e13ba83 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c | |||
| @@ -173,26 +173,26 @@ static const struct file_operations osd_fops = { | |||
| 173 | .unlocked_ioctl = osd_uld_ioctl, | 173 | .unlocked_ioctl = osd_uld_ioctl, |
| 174 | }; | 174 | }; |
| 175 | 175 | ||
| 176 | struct osd_dev *osduld_path_lookup(const char *path) | 176 | struct osd_dev *osduld_path_lookup(const char *name) |
| 177 | { | 177 | { |
| 178 | struct nameidata nd; | 178 | struct path path; |
| 179 | struct inode *inode; | 179 | struct inode *inode; |
| 180 | struct cdev *cdev; | 180 | struct cdev *cdev; |
| 181 | struct osd_uld_device *uninitialized_var(oud); | 181 | struct osd_uld_device *uninitialized_var(oud); |
| 182 | int error; | 182 | int error; |
| 183 | 183 | ||
| 184 | if (!path || !*path) { | 184 | if (!name || !*name) { |
| 185 | OSD_ERR("Mount with !path || !*path\n"); | 185 | OSD_ERR("Mount with !path || !*path\n"); |
| 186 | return ERR_PTR(-EINVAL); | 186 | return ERR_PTR(-EINVAL); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | error = path_lookup(path, LOOKUP_FOLLOW, &nd); | 189 | error = kern_path(name, LOOKUP_FOLLOW, &path); |
| 190 | if (error) { | 190 | if (error) { |
| 191 | OSD_ERR("path_lookup of %s faild=>%d\n", path, error); | 191 | OSD_ERR("path_lookup of %s failed=>%d\n", name, error); |
| 192 | return ERR_PTR(error); | 192 | return ERR_PTR(error); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | inode = nd.path.dentry->d_inode; | 195 | inode = path.dentry->d_inode; |
| 196 | error = -EINVAL; /* Not the right device e.g osd_uld_device */ | 196 | error = -EINVAL; /* Not the right device e.g osd_uld_device */ |
| 197 | if (!S_ISCHR(inode->i_mode)) { | 197 | if (!S_ISCHR(inode->i_mode)) { |
| 198 | OSD_DEBUG("!S_ISCHR()\n"); | 198 | OSD_DEBUG("!S_ISCHR()\n"); |
| @@ -202,15 +202,15 @@ struct osd_dev *osduld_path_lookup(const char *path) | |||
| 202 | cdev = inode->i_cdev; | 202 | cdev = inode->i_cdev; |
| 203 | if (!cdev) { | 203 | if (!cdev) { |
| 204 | OSD_ERR("Before mounting an OSD Based filesystem\n"); | 204 | OSD_ERR("Before mounting an OSD Based filesystem\n"); |
| 205 | OSD_ERR(" user-mode must open+close the %s device\n", path); | 205 | OSD_ERR(" user-mode must open+close the %s device\n", name); |
| 206 | OSD_ERR(" Example: bash: echo < %s\n", path); | 206 | OSD_ERR(" Example: bash: echo < %s\n", name); |
| 207 | goto out; | 207 | goto out; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | /* The Magic wand. Is it our char-dev */ | 210 | /* The Magic wand. Is it our char-dev */ |
| 211 | /* TODO: Support sg devices */ | 211 | /* TODO: Support sg devices */ |
| 212 | if (cdev->owner != THIS_MODULE) { | 212 | if (cdev->owner != THIS_MODULE) { |
| 213 | OSD_ERR("Error mounting %s - is not an OSD device\n", path); | 213 | OSD_ERR("Error mounting %s - is not an OSD device\n", name); |
| 214 | goto out; | 214 | goto out; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| @@ -220,7 +220,7 @@ struct osd_dev *osduld_path_lookup(const char *path) | |||
| 220 | error = 0; | 220 | error = 0; |
| 221 | 221 | ||
| 222 | out: | 222 | out: |
| 223 | path_put(&nd.path); | 223 | path_put(&path); |
| 224 | return error ? ERR_PTR(error) : &oud->od; | 224 | return error ? ERR_PTR(error) : &oud->od; |
| 225 | } | 225 | } |
| 226 | EXPORT_SYMBOL(osduld_path_lookup); | 226 | EXPORT_SYMBOL(osduld_path_lookup); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 5f8ab8adb5f5..ab5547ff29a1 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/mount.h> | 37 | #include <linux/mount.h> |
| 38 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
| 39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
| 40 | #include <linux/smp_lock.h> | ||
| 40 | #include <net/9p/9p.h> | 41 | #include <net/9p/9p.h> |
| 41 | #include <net/9p/client.h> | 42 | #include <net/9p/client.h> |
| 42 | 43 | ||
| @@ -155,6 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 155 | 156 | ||
| 156 | root = d_alloc_root(inode); | 157 | root = d_alloc_root(inode); |
| 157 | if (!root) { | 158 | if (!root) { |
| 159 | iput(inode); | ||
| 158 | retval = -ENOMEM; | 160 | retval = -ENOMEM; |
| 159 | goto release_sb; | 161 | goto release_sb; |
| 160 | } | 162 | } |
| @@ -173,10 +175,7 @@ P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |||
| 173 | return 0; | 175 | return 0; |
| 174 | 176 | ||
| 175 | release_sb: | 177 | release_sb: |
| 176 | if (sb) { | 178 | deactivate_locked_super(sb); |
| 177 | up_write(&sb->s_umount); | ||
| 178 | deactivate_super(sb); | ||
| 179 | } | ||
| 180 | 179 | ||
| 181 | free_stat: | 180 | free_stat: |
| 182 | kfree(st); | 181 | kfree(st); |
| @@ -230,9 +229,12 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
| 230 | static void | 229 | static void |
| 231 | v9fs_umount_begin(struct super_block *sb) | 230 | v9fs_umount_begin(struct super_block *sb) |
| 232 | { | 231 | { |
| 233 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 232 | struct v9fs_session_info *v9ses; |
| 234 | 233 | ||
| 234 | lock_kernel(); | ||
| 235 | v9ses = sb->s_fs_info; | ||
| 235 | v9fs_session_cancel(v9ses); | 236 | v9fs_session_cancel(v9ses); |
| 237 | unlock_kernel(); | ||
| 236 | } | 238 | } |
| 237 | 239 | ||
| 238 | static const struct super_operations v9fs_super_ops = { | 240 | static const struct super_operations v9fs_super_ops = { |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 5ce695e707fe..63f5183f263b 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
| @@ -507,8 +507,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
| 507 | kfree(new_opts); | 507 | kfree(new_opts); |
| 508 | return -EINVAL; | 508 | return -EINVAL; |
| 509 | } | 509 | } |
| 510 | kfree(sb->s_options); | 510 | replace_mount_options(sb, new_opts); |
| 511 | sb->s_options = new_opts; | ||
| 512 | 511 | ||
| 513 | sbi->s_flags = mount_flags; | 512 | sbi->s_flags = mount_flags; |
| 514 | sbi->s_mode = mode; | 513 | sbi->s_mode = mode; |
diff --git a/fs/afs/super.c b/fs/afs/super.c index aee239a048cb..76828e5f8a39 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
| @@ -405,21 +405,20 @@ static int afs_get_sb(struct file_system_type *fs_type, | |||
| 405 | sb->s_flags = flags; | 405 | sb->s_flags = flags; |
| 406 | ret = afs_fill_super(sb, ¶ms); | 406 | ret = afs_fill_super(sb, ¶ms); |
| 407 | if (ret < 0) { | 407 | if (ret < 0) { |
| 408 | up_write(&sb->s_umount); | 408 | deactivate_locked_super(sb); |
| 409 | deactivate_super(sb); | ||
| 410 | goto error; | 409 | goto error; |
| 411 | } | 410 | } |
| 412 | sb->s_options = new_opts; | 411 | save_mount_options(sb, new_opts); |
| 413 | sb->s_flags |= MS_ACTIVE; | 412 | sb->s_flags |= MS_ACTIVE; |
| 414 | } else { | 413 | } else { |
| 415 | _debug("reuse"); | 414 | _debug("reuse"); |
| 416 | kfree(new_opts); | ||
| 417 | ASSERTCMP(sb->s_flags, &, MS_ACTIVE); | 415 | ASSERTCMP(sb->s_flags, &, MS_ACTIVE); |
| 418 | } | 416 | } |
| 419 | 417 | ||
| 420 | simple_set_mnt(mnt, sb); | 418 | simple_set_mnt(mnt, sb); |
| 421 | afs_put_volume(params.volume); | 419 | afs_put_volume(params.volume); |
| 422 | afs_put_cell(params.cell); | 420 | afs_put_cell(params.cell); |
| 421 | kfree(new_opts); | ||
| 423 | _leave(" = 0 [%p]", sb); | 422 | _leave(" = 0 [%p]", sb); |
| 424 | return 0; | 423 | return 0; |
| 425 | 424 | ||
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 3536bdb2d7cb..6dfae5b28f59 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -502,8 +502,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 502 | 502 | ||
| 503 | if (s->s_root) { | 503 | if (s->s_root) { |
| 504 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 504 | if ((flags ^ s->s_flags) & MS_RDONLY) { |
| 505 | up_write(&s->s_umount); | 505 | deactivate_locked_super(s); |
| 506 | deactivate_super(s); | ||
| 507 | error = -EBUSY; | 506 | error = -EBUSY; |
| 508 | goto error_close_devices; | 507 | goto error_close_devices; |
| 509 | } | 508 | } |
| @@ -517,8 +516,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 517 | error = btrfs_fill_super(s, fs_devices, data, | 516 | error = btrfs_fill_super(s, fs_devices, data, |
| 518 | flags & MS_SILENT ? 1 : 0); | 517 | flags & MS_SILENT ? 1 : 0); |
| 519 | if (error) { | 518 | if (error) { |
| 520 | up_write(&s->s_umount); | 519 | deactivate_locked_super(s); |
| 521 | deactivate_super(s); | ||
| 522 | goto error_free_subvol_name; | 520 | goto error_free_subvol_name; |
| 523 | } | 521 | } |
| 524 | 522 | ||
| @@ -535,15 +533,13 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 535 | mutex_unlock(&s->s_root->d_inode->i_mutex); | 533 | mutex_unlock(&s->s_root->d_inode->i_mutex); |
| 536 | 534 | ||
| 537 | if (IS_ERR(root)) { | 535 | if (IS_ERR(root)) { |
| 538 | up_write(&s->s_umount); | 536 | deactivate_locked_super(s); |
| 539 | deactivate_super(s); | ||
| 540 | error = PTR_ERR(root); | 537 | error = PTR_ERR(root); |
| 541 | goto error_free_subvol_name; | 538 | goto error_free_subvol_name; |
| 542 | } | 539 | } |
| 543 | if (!root->d_inode) { | 540 | if (!root->d_inode) { |
| 544 | dput(root); | 541 | dput(root); |
| 545 | up_write(&s->s_umount); | 542 | deactivate_locked_super(s); |
| 546 | deactivate_super(s); | ||
| 547 | error = -ENXIO; | 543 | error = -ENXIO; |
| 548 | goto error_free_subvol_name; | 544 | goto error_free_subvol_name; |
| 549 | } | 545 | } |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0d6d8b573652..5e6d35804d73 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
| 36 | #include <linux/kthread.h> | 36 | #include <linux/kthread.h> |
| 37 | #include <linux/freezer.h> | 37 | #include <linux/freezer.h> |
| 38 | #include <linux/smp_lock.h> | ||
| 38 | #include "cifsfs.h" | 39 | #include "cifsfs.h" |
| 39 | #include "cifspdu.h" | 40 | #include "cifspdu.h" |
| 40 | #define DECLARE_GLOBALS_HERE | 41 | #define DECLARE_GLOBALS_HERE |
| @@ -530,6 +531,7 @@ static void cifs_umount_begin(struct super_block *sb) | |||
| 530 | if (tcon == NULL) | 531 | if (tcon == NULL) |
| 531 | return; | 532 | return; |
| 532 | 533 | ||
| 534 | lock_kernel(); | ||
| 533 | read_lock(&cifs_tcp_ses_lock); | 535 | read_lock(&cifs_tcp_ses_lock); |
| 534 | if (tcon->tc_count == 1) | 536 | if (tcon->tc_count == 1) |
| 535 | tcon->tidStatus = CifsExiting; | 537 | tcon->tidStatus = CifsExiting; |
| @@ -548,6 +550,7 @@ static void cifs_umount_begin(struct super_block *sb) | |||
| 548 | } | 550 | } |
| 549 | /* BB FIXME - finish add checks for tidStatus BB */ | 551 | /* BB FIXME - finish add checks for tidStatus BB */ |
| 550 | 552 | ||
| 553 | unlock_kernel(); | ||
| 551 | return; | 554 | return; |
| 552 | } | 555 | } |
| 553 | 556 | ||
| @@ -599,8 +602,7 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
| 599 | 602 | ||
| 600 | rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); | 603 | rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); |
| 601 | if (rc) { | 604 | if (rc) { |
| 602 | up_write(&sb->s_umount); | 605 | deactivate_locked_super(sb); |
| 603 | deactivate_super(sb); | ||
| 604 | return rc; | 606 | return rc; |
| 605 | } | 607 | } |
| 606 | sb->s_flags |= MS_ACTIVE; | 608 | sb->s_flags |= MS_ACTIVE; |
diff --git a/fs/dcache.c b/fs/dcache.c index 1fcffebfb44f..75659a6fd1f8 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -481,7 +481,7 @@ restart: | |||
| 481 | if ((flags & DCACHE_REFERENCED) | 481 | if ((flags & DCACHE_REFERENCED) |
| 482 | && (dentry->d_flags & DCACHE_REFERENCED)) { | 482 | && (dentry->d_flags & DCACHE_REFERENCED)) { |
| 483 | dentry->d_flags &= ~DCACHE_REFERENCED; | 483 | dentry->d_flags &= ~DCACHE_REFERENCED; |
| 484 | list_move_tail(&dentry->d_lru, &referenced); | 484 | list_move(&dentry->d_lru, &referenced); |
| 485 | spin_unlock(&dentry->d_lock); | 485 | spin_unlock(&dentry->d_lock); |
| 486 | } else { | 486 | } else { |
| 487 | list_move_tail(&dentry->d_lru, &tmp); | 487 | list_move_tail(&dentry->d_lru, &tmp); |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 63a4a59e4148..21165cf934ff 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
| @@ -389,11 +389,10 @@ static int devpts_get_sb(struct file_system_type *fs_type, | |||
| 389 | return 0; | 389 | return 0; |
| 390 | 390 | ||
| 391 | out_dput: | 391 | out_dput: |
| 392 | dput(s->s_root); | 392 | dput(s->s_root); /* undo dget() in simple_set_mnt() */ |
| 393 | 393 | ||
| 394 | out_undo_sget: | 394 | out_undo_sget: |
| 395 | up_write(&s->s_umount); | 395 | deactivate_locked_super(s); |
| 396 | deactivate_super(s); | ||
| 397 | return error; | 396 | return error; |
| 398 | } | 397 | } |
| 399 | 398 | ||
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index ccabd5faa04d..9f0aa9883c28 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -614,9 +614,8 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 614 | } | 614 | } |
| 615 | goto out; | 615 | goto out; |
| 616 | out_abort: | 616 | out_abort: |
| 617 | dput(sb->s_root); | 617 | dput(sb->s_root); /* aka mnt->mnt_root, as set by get_sb_nodev() */ |
| 618 | up_write(&sb->s_umount); | 618 | deactivate_locked_super(sb); |
| 619 | deactivate_super(sb); | ||
| 620 | out: | 619 | out: |
| 621 | return rc; | 620 | return rc; |
| 622 | } | 621 | } |
| @@ -105,40 +105,28 @@ static inline void put_binfmt(struct linux_binfmt * fmt) | |||
| 105 | SYSCALL_DEFINE1(uselib, const char __user *, library) | 105 | SYSCALL_DEFINE1(uselib, const char __user *, library) |
| 106 | { | 106 | { |
| 107 | struct file *file; | 107 | struct file *file; |
| 108 | struct nameidata nd; | ||
| 109 | char *tmp = getname(library); | 108 | char *tmp = getname(library); |
| 110 | int error = PTR_ERR(tmp); | 109 | int error = PTR_ERR(tmp); |
| 111 | 110 | ||
| 112 | if (!IS_ERR(tmp)) { | 111 | if (IS_ERR(tmp)) |
| 113 | error = path_lookup_open(AT_FDCWD, tmp, | 112 | goto out; |
| 114 | LOOKUP_FOLLOW, &nd, | 113 | |
| 115 | FMODE_READ|FMODE_EXEC); | 114 | file = do_filp_open(AT_FDCWD, tmp, |
| 116 | putname(tmp); | 115 | O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, |
| 117 | } | 116 | MAY_READ | MAY_EXEC | MAY_OPEN); |
| 118 | if (error) | 117 | putname(tmp); |
| 118 | error = PTR_ERR(file); | ||
| 119 | if (IS_ERR(file)) | ||
| 119 | goto out; | 120 | goto out; |
| 120 | 121 | ||
| 121 | error = -EINVAL; | 122 | error = -EINVAL; |
| 122 | if (!S_ISREG(nd.path.dentry->d_inode->i_mode)) | 123 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) |
| 123 | goto exit; | 124 | goto exit; |
| 124 | 125 | ||
| 125 | error = -EACCES; | 126 | error = -EACCES; |
| 126 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) | 127 | if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) |
| 127 | goto exit; | ||
| 128 | |||
| 129 | error = inode_permission(nd.path.dentry->d_inode, | ||
| 130 | MAY_READ | MAY_EXEC | MAY_OPEN); | ||
| 131 | if (error) | ||
| 132 | goto exit; | ||
| 133 | error = ima_path_check(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN); | ||
| 134 | if (error) | ||
| 135 | goto exit; | 128 | goto exit; |
| 136 | 129 | ||
| 137 | file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE); | ||
| 138 | error = PTR_ERR(file); | ||
| 139 | if (IS_ERR(file)) | ||
| 140 | goto out; | ||
| 141 | |||
| 142 | fsnotify_open(file->f_path.dentry); | 130 | fsnotify_open(file->f_path.dentry); |
| 143 | 131 | ||
| 144 | error = -ENOEXEC; | 132 | error = -ENOEXEC; |
| @@ -160,13 +148,10 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) | |||
| 160 | } | 148 | } |
| 161 | read_unlock(&binfmt_lock); | 149 | read_unlock(&binfmt_lock); |
| 162 | } | 150 | } |
| 151 | exit: | ||
| 163 | fput(file); | 152 | fput(file); |
| 164 | out: | 153 | out: |
| 165 | return error; | 154 | return error; |
| 166 | exit: | ||
| 167 | release_open_intent(&nd); | ||
| 168 | path_put(&nd.path); | ||
| 169 | goto out; | ||
| 170 | } | 155 | } |
| 171 | 156 | ||
| 172 | #ifdef CONFIG_MMU | 157 | #ifdef CONFIG_MMU |
| @@ -661,47 +646,33 @@ EXPORT_SYMBOL(setup_arg_pages); | |||
| 661 | 646 | ||
| 662 | struct file *open_exec(const char *name) | 647 | struct file *open_exec(const char *name) |
| 663 | { | 648 | { |
| 664 | struct nameidata nd; | ||
| 665 | struct file *file; | 649 | struct file *file; |
| 666 | int err; | 650 | int err; |
| 667 | 651 | ||
| 668 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, | 652 | file = do_filp_open(AT_FDCWD, name, |
| 669 | FMODE_READ|FMODE_EXEC); | 653 | O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, |
| 670 | if (err) | 654 | MAY_EXEC | MAY_OPEN); |
| 655 | if (IS_ERR(file)) | ||
| 671 | goto out; | 656 | goto out; |
| 672 | 657 | ||
| 673 | err = -EACCES; | 658 | err = -EACCES; |
| 674 | if (!S_ISREG(nd.path.dentry->d_inode->i_mode)) | 659 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) |
| 675 | goto out_path_put; | 660 | goto exit; |
| 676 | |||
| 677 | if (nd.path.mnt->mnt_flags & MNT_NOEXEC) | ||
| 678 | goto out_path_put; | ||
| 679 | |||
| 680 | err = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_OPEN); | ||
| 681 | if (err) | ||
| 682 | goto out_path_put; | ||
| 683 | err = ima_path_check(&nd.path, MAY_EXEC | MAY_OPEN); | ||
| 684 | if (err) | ||
| 685 | goto out_path_put; | ||
| 686 | 661 | ||
| 687 | file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE); | 662 | if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) |
| 688 | if (IS_ERR(file)) | 663 | goto exit; |
| 689 | return file; | ||
| 690 | 664 | ||
| 691 | fsnotify_open(file->f_path.dentry); | 665 | fsnotify_open(file->f_path.dentry); |
| 692 | 666 | ||
| 693 | err = deny_write_access(file); | 667 | err = deny_write_access(file); |
| 694 | if (err) { | 668 | if (err) |
| 695 | fput(file); | 669 | goto exit; |
| 696 | goto out; | ||
| 697 | } | ||
| 698 | 670 | ||
| 671 | out: | ||
| 699 | return file; | 672 | return file; |
| 700 | 673 | ||
| 701 | out_path_put: | 674 | exit: |
| 702 | release_open_intent(&nd); | 675 | fput(file); |
| 703 | path_put(&nd.path); | ||
| 704 | out: | ||
| 705 | return ERR_PTR(err); | 676 | return ERR_PTR(err); |
| 706 | } | 677 | } |
| 707 | EXPORT_SYMBOL(open_exec); | 678 | EXPORT_SYMBOL(open_exec); |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 459b73dd45e1..d1bc4d33ccbc 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/random.h> | 19 | #include <linux/random.h> |
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | #include <linux/exportfs.h> | 21 | #include <linux/exportfs.h> |
| 22 | #include <linux/smp_lock.h> | ||
| 22 | 23 | ||
| 23 | MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>"); | 24 | MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>"); |
| 24 | MODULE_DESCRIPTION("Filesystem in Userspace"); | 25 | MODULE_DESCRIPTION("Filesystem in Userspace"); |
| @@ -259,7 +260,9 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, | |||
| 259 | 260 | ||
| 260 | static void fuse_umount_begin(struct super_block *sb) | 261 | static void fuse_umount_begin(struct super_block *sb) |
| 261 | { | 262 | { |
| 263 | lock_kernel(); | ||
| 262 | fuse_abort_conn(get_fuse_conn_super(sb)); | 264 | fuse_abort_conn(get_fuse_conn_super(sb)); |
| 265 | unlock_kernel(); | ||
| 263 | } | 266 | } |
| 264 | 267 | ||
| 265 | static void fuse_send_destroy(struct fuse_conn *fc) | 268 | static void fuse_send_destroy(struct fuse_conn *fc) |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 650a730707b7..1ff9473ea753 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
| @@ -1282,21 +1282,21 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags, | |||
| 1282 | static struct super_block *get_gfs2_sb(const char *dev_name) | 1282 | static struct super_block *get_gfs2_sb(const char *dev_name) |
| 1283 | { | 1283 | { |
| 1284 | struct super_block *sb; | 1284 | struct super_block *sb; |
| 1285 | struct nameidata nd; | 1285 | struct path path; |
| 1286 | int error; | 1286 | int error; |
| 1287 | 1287 | ||
| 1288 | error = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); | 1288 | error = kern_path(dev_name, LOOKUP_FOLLOW, &path); |
| 1289 | if (error) { | 1289 | if (error) { |
| 1290 | printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", | 1290 | printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", |
| 1291 | dev_name, error); | 1291 | dev_name, error); |
| 1292 | return NULL; | 1292 | return NULL; |
| 1293 | } | 1293 | } |
| 1294 | sb = nd.path.dentry->d_inode->i_sb; | 1294 | sb = path.dentry->d_inode->i_sb; |
| 1295 | if (sb && (sb->s_type == &gfs2_fs_type)) | 1295 | if (sb && (sb->s_type == &gfs2_fs_type)) |
| 1296 | atomic_inc(&sb->s_active); | 1296 | atomic_inc(&sb->s_active); |
| 1297 | else | 1297 | else |
| 1298 | sb = NULL; | 1298 | sb = NULL; |
| 1299 | path_put(&nd.path); | 1299 | path_put(&path); |
| 1300 | return sb; | 1300 | return sb; |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index fecf402d7b8a..fc77965be841 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
| @@ -423,8 +423,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
| 423 | 423 | ||
| 424 | if (!(*flags & MS_RDONLY)) mark_dirty(s); | 424 | if (!(*flags & MS_RDONLY)) mark_dirty(s); |
| 425 | 425 | ||
| 426 | kfree(s->s_options); | 426 | replace_mount_options(s, new_opts); |
| 427 | s->s_options = new_opts; | ||
| 428 | 427 | ||
| 429 | return 0; | 428 | return 0; |
| 430 | 429 | ||
diff --git a/fs/inode.c b/fs/inode.c index 6ad14a1cd8c9..0571983755dc 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
| @@ -99,7 +99,7 @@ static DEFINE_MUTEX(iprune_mutex); | |||
| 99 | */ | 99 | */ |
| 100 | struct inodes_stat_t inodes_stat; | 100 | struct inodes_stat_t inodes_stat; |
| 101 | 101 | ||
| 102 | static struct kmem_cache * inode_cachep __read_mostly; | 102 | static struct kmem_cache *inode_cachep __read_mostly; |
| 103 | 103 | ||
| 104 | static void wake_up_inode(struct inode *inode) | 104 | static void wake_up_inode(struct inode *inode) |
| 105 | { | 105 | { |
| @@ -124,7 +124,7 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode) | |||
| 124 | static struct inode_operations empty_iops; | 124 | static struct inode_operations empty_iops; |
| 125 | static const struct file_operations empty_fops; | 125 | static const struct file_operations empty_fops; |
| 126 | 126 | ||
| 127 | struct address_space * const mapping = &inode->i_data; | 127 | struct address_space *const mapping = &inode->i_data; |
| 128 | 128 | ||
| 129 | inode->i_sb = sb; | 129 | inode->i_sb = sb; |
| 130 | inode->i_blkbits = sb->s_blocksize_bits; | 130 | inode->i_blkbits = sb->s_blocksize_bits; |
| @@ -216,7 +216,7 @@ static struct inode *alloc_inode(struct super_block *sb) | |||
| 216 | return NULL; | 216 | return NULL; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | void destroy_inode(struct inode *inode) | 219 | void destroy_inode(struct inode *inode) |
| 220 | { | 220 | { |
| 221 | BUG_ON(inode_has_buffers(inode)); | 221 | BUG_ON(inode_has_buffers(inode)); |
| 222 | security_inode_free(inode); | 222 | security_inode_free(inode); |
| @@ -252,12 +252,11 @@ void inode_init_once(struct inode *inode) | |||
| 252 | mutex_init(&inode->inotify_mutex); | 252 | mutex_init(&inode->inotify_mutex); |
| 253 | #endif | 253 | #endif |
| 254 | } | 254 | } |
| 255 | |||
| 256 | EXPORT_SYMBOL(inode_init_once); | 255 | EXPORT_SYMBOL(inode_init_once); |
| 257 | 256 | ||
| 258 | static void init_once(void *foo) | 257 | static void init_once(void *foo) |
| 259 | { | 258 | { |
| 260 | struct inode * inode = (struct inode *) foo; | 259 | struct inode *inode = (struct inode *) foo; |
| 261 | 260 | ||
| 262 | inode_init_once(inode); | 261 | inode_init_once(inode); |
| 263 | } | 262 | } |
| @@ -265,7 +264,7 @@ static void init_once(void *foo) | |||
| 265 | /* | 264 | /* |
| 266 | * inode_lock must be held | 265 | * inode_lock must be held |
| 267 | */ | 266 | */ |
| 268 | void __iget(struct inode * inode) | 267 | void __iget(struct inode *inode) |
| 269 | { | 268 | { |
| 270 | if (atomic_read(&inode->i_count)) { | 269 | if (atomic_read(&inode->i_count)) { |
| 271 | atomic_inc(&inode->i_count); | 270 | atomic_inc(&inode->i_count); |
| @@ -289,7 +288,7 @@ void clear_inode(struct inode *inode) | |||
| 289 | { | 288 | { |
| 290 | might_sleep(); | 289 | might_sleep(); |
| 291 | invalidate_inode_buffers(inode); | 290 | invalidate_inode_buffers(inode); |
| 292 | 291 | ||
| 293 | BUG_ON(inode->i_data.nrpages); | 292 | BUG_ON(inode->i_data.nrpages); |
| 294 | BUG_ON(!(inode->i_state & I_FREEING)); | 293 | BUG_ON(!(inode->i_state & I_FREEING)); |
| 295 | BUG_ON(inode->i_state & I_CLEAR); | 294 | BUG_ON(inode->i_state & I_CLEAR); |
| @@ -303,7 +302,6 @@ void clear_inode(struct inode *inode) | |||
| 303 | cd_forget(inode); | 302 | cd_forget(inode); |
| 304 | inode->i_state = I_CLEAR; | 303 | inode->i_state = I_CLEAR; |
| 305 | } | 304 | } |
| 306 | |||
| 307 | EXPORT_SYMBOL(clear_inode); | 305 | EXPORT_SYMBOL(clear_inode); |
| 308 | 306 | ||
| 309 | /* | 307 | /* |
| @@ -351,8 +349,8 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose) | |||
| 351 | 349 | ||
| 352 | next = head->next; | 350 | next = head->next; |
| 353 | for (;;) { | 351 | for (;;) { |
| 354 | struct list_head * tmp = next; | 352 | struct list_head *tmp = next; |
| 355 | struct inode * inode; | 353 | struct inode *inode; |
| 356 | 354 | ||
| 357 | /* | 355 | /* |
| 358 | * We can reschedule here without worrying about the list's | 356 | * We can reschedule here without worrying about the list's |
| @@ -391,7 +389,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose) | |||
| 391 | * fails because there are busy inodes then a non zero value is returned. | 389 | * fails because there are busy inodes then a non zero value is returned. |
| 392 | * If the discard is successful all the inodes have been discarded. | 390 | * If the discard is successful all the inodes have been discarded. |
| 393 | */ | 391 | */ |
| 394 | int invalidate_inodes(struct super_block * sb) | 392 | int invalidate_inodes(struct super_block *sb) |
| 395 | { | 393 | { |
| 396 | int busy; | 394 | int busy; |
| 397 | LIST_HEAD(throw_away); | 395 | LIST_HEAD(throw_away); |
| @@ -407,7 +405,6 @@ int invalidate_inodes(struct super_block * sb) | |||
| 407 | 405 | ||
| 408 | return busy; | 406 | return busy; |
| 409 | } | 407 | } |
| 410 | |||
| 411 | EXPORT_SYMBOL(invalidate_inodes); | 408 | EXPORT_SYMBOL(invalidate_inodes); |
| 412 | 409 | ||
| 413 | static int can_unuse(struct inode *inode) | 410 | static int can_unuse(struct inode *inode) |
| @@ -504,7 +501,7 @@ static int shrink_icache_memory(int nr, gfp_t gfp_mask) | |||
| 504 | * Nasty deadlock avoidance. We may hold various FS locks, | 501 | * Nasty deadlock avoidance. We may hold various FS locks, |
| 505 | * and we don't want to recurse into the FS that called us | 502 | * and we don't want to recurse into the FS that called us |
| 506 | * in clear_inode() and friends.. | 503 | * in clear_inode() and friends.. |
| 507 | */ | 504 | */ |
| 508 | if (!(gfp_mask & __GFP_FS)) | 505 | if (!(gfp_mask & __GFP_FS)) |
| 509 | return -1; | 506 | return -1; |
| 510 | prune_icache(nr); | 507 | prune_icache(nr); |
| @@ -524,10 +521,13 @@ static void __wait_on_freeing_inode(struct inode *inode); | |||
| 524 | * by hand after calling find_inode now! This simplifies iunique and won't | 521 | * by hand after calling find_inode now! This simplifies iunique and won't |
| 525 | * add any additional branch in the common code. | 522 | * add any additional branch in the common code. |
| 526 | */ | 523 | */ |
| 527 | static struct inode * find_inode(struct super_block * sb, struct hlist_head *head, int (*test)(struct inode *, void *), void *data) | 524 | static struct inode *find_inode(struct super_block *sb, |
| 525 | struct hlist_head *head, | ||
| 526 | int (*test)(struct inode *, void *), | ||
| 527 | void *data) | ||
| 528 | { | 528 | { |
| 529 | struct hlist_node *node; | 529 | struct hlist_node *node; |
| 530 | struct inode * inode = NULL; | 530 | struct inode *inode = NULL; |
| 531 | 531 | ||
| 532 | repeat: | 532 | repeat: |
| 533 | hlist_for_each_entry(inode, node, head, i_hash) { | 533 | hlist_for_each_entry(inode, node, head, i_hash) { |
| @@ -548,10 +548,11 @@ repeat: | |||
| 548 | * find_inode_fast is the fast path version of find_inode, see the comment at | 548 | * find_inode_fast is the fast path version of find_inode, see the comment at |
| 549 | * iget_locked for details. | 549 | * iget_locked for details. |
| 550 | */ | 550 | */ |
| 551 | static struct inode * find_inode_fast(struct super_block * sb, struct hlist_head *head, unsigned long ino) | 551 | static struct inode *find_inode_fast(struct super_block *sb, |
| 552 | struct hlist_head *head, unsigned long ino) | ||
| 552 | { | 553 | { |
| 553 | struct hlist_node *node; | 554 | struct hlist_node *node; |
| 554 | struct inode * inode = NULL; | 555 | struct inode *inode = NULL; |
| 555 | 556 | ||
| 556 | repeat: | 557 | repeat: |
| 557 | hlist_for_each_entry(inode, node, head, i_hash) { | 558 | hlist_for_each_entry(inode, node, head, i_hash) { |
| @@ -631,10 +632,10 @@ struct inode *new_inode(struct super_block *sb) | |||
| 631 | * here to attempt to avoid that. | 632 | * here to attempt to avoid that. |
| 632 | */ | 633 | */ |
| 633 | static unsigned int last_ino; | 634 | static unsigned int last_ino; |
| 634 | struct inode * inode; | 635 | struct inode *inode; |
| 635 | 636 | ||
| 636 | spin_lock_prefetch(&inode_lock); | 637 | spin_lock_prefetch(&inode_lock); |
| 637 | 638 | ||
| 638 | inode = alloc_inode(sb); | 639 | inode = alloc_inode(sb); |
| 639 | if (inode) { | 640 | if (inode) { |
| 640 | spin_lock(&inode_lock); | 641 | spin_lock(&inode_lock); |
| @@ -645,7 +646,6 @@ struct inode *new_inode(struct super_block *sb) | |||
| 645 | } | 646 | } |
| 646 | return inode; | 647 | return inode; |
| 647 | } | 648 | } |
| 648 | |||
| 649 | EXPORT_SYMBOL(new_inode); | 649 | EXPORT_SYMBOL(new_inode); |
| 650 | 650 | ||
| 651 | void unlock_new_inode(struct inode *inode) | 651 | void unlock_new_inode(struct inode *inode) |
| @@ -674,7 +674,6 @@ void unlock_new_inode(struct inode *inode) | |||
| 674 | inode->i_state &= ~(I_LOCK|I_NEW); | 674 | inode->i_state &= ~(I_LOCK|I_NEW); |
| 675 | wake_up_inode(inode); | 675 | wake_up_inode(inode); |
| 676 | } | 676 | } |
| 677 | |||
| 678 | EXPORT_SYMBOL(unlock_new_inode); | 677 | EXPORT_SYMBOL(unlock_new_inode); |
| 679 | 678 | ||
| 680 | /* | 679 | /* |
| @@ -683,13 +682,17 @@ EXPORT_SYMBOL(unlock_new_inode); | |||
| 683 | * We no longer cache the sb_flags in i_flags - see fs.h | 682 | * We no longer cache the sb_flags in i_flags - see fs.h |
| 684 | * -- rmk@arm.uk.linux.org | 683 | * -- rmk@arm.uk.linux.org |
| 685 | */ | 684 | */ |
| 686 | static struct inode * get_new_inode(struct super_block *sb, struct hlist_head *head, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *data) | 685 | static struct inode *get_new_inode(struct super_block *sb, |
| 686 | struct hlist_head *head, | ||
| 687 | int (*test)(struct inode *, void *), | ||
| 688 | int (*set)(struct inode *, void *), | ||
| 689 | void *data) | ||
| 687 | { | 690 | { |
| 688 | struct inode * inode; | 691 | struct inode *inode; |
| 689 | 692 | ||
| 690 | inode = alloc_inode(sb); | 693 | inode = alloc_inode(sb); |
| 691 | if (inode) { | 694 | if (inode) { |
| 692 | struct inode * old; | 695 | struct inode *old; |
| 693 | 696 | ||
| 694 | spin_lock(&inode_lock); | 697 | spin_lock(&inode_lock); |
| 695 | /* We released the lock, so.. */ | 698 | /* We released the lock, so.. */ |
| @@ -731,13 +734,14 @@ set_failed: | |||
| 731 | * get_new_inode_fast is the fast path version of get_new_inode, see the | 734 | * get_new_inode_fast is the fast path version of get_new_inode, see the |
| 732 | * comment at iget_locked for details. | 735 | * comment at iget_locked for details. |
| 733 | */ | 736 | */ |
| 734 | static struct inode * get_new_inode_fast(struct super_block *sb, struct hlist_head *head, unsigned long ino) | 737 | static struct inode *get_new_inode_fast(struct super_block *sb, |
| 738 | struct hlist_head *head, unsigned long ino) | ||
| 735 | { | 739 | { |
| 736 | struct inode * inode; | 740 | struct inode *inode; |
| 737 | 741 | ||
| 738 | inode = alloc_inode(sb); | 742 | inode = alloc_inode(sb); |
| 739 | if (inode) { | 743 | if (inode) { |
| 740 | struct inode * old; | 744 | struct inode *old; |
| 741 | 745 | ||
| 742 | spin_lock(&inode_lock); | 746 | spin_lock(&inode_lock); |
| 743 | /* We released the lock, so.. */ | 747 | /* We released the lock, so.. */ |
| @@ -823,7 +827,6 @@ struct inode *igrab(struct inode *inode) | |||
| 823 | spin_unlock(&inode_lock); | 827 | spin_unlock(&inode_lock); |
| 824 | return inode; | 828 | return inode; |
| 825 | } | 829 | } |
| 826 | |||
| 827 | EXPORT_SYMBOL(igrab); | 830 | EXPORT_SYMBOL(igrab); |
| 828 | 831 | ||
| 829 | /** | 832 | /** |
| @@ -924,7 +927,6 @@ struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval, | |||
| 924 | 927 | ||
| 925 | return ifind(sb, head, test, data, 0); | 928 | return ifind(sb, head, test, data, 0); |
| 926 | } | 929 | } |
| 927 | |||
| 928 | EXPORT_SYMBOL(ilookup5_nowait); | 930 | EXPORT_SYMBOL(ilookup5_nowait); |
| 929 | 931 | ||
| 930 | /** | 932 | /** |
| @@ -953,7 +955,6 @@ struct inode *ilookup5(struct super_block *sb, unsigned long hashval, | |||
| 953 | 955 | ||
| 954 | return ifind(sb, head, test, data, 1); | 956 | return ifind(sb, head, test, data, 1); |
| 955 | } | 957 | } |
| 956 | |||
| 957 | EXPORT_SYMBOL(ilookup5); | 958 | EXPORT_SYMBOL(ilookup5); |
| 958 | 959 | ||
| 959 | /** | 960 | /** |
| @@ -976,7 +977,6 @@ struct inode *ilookup(struct super_block *sb, unsigned long ino) | |||
| 976 | 977 | ||
| 977 | return ifind_fast(sb, head, ino); | 978 | return ifind_fast(sb, head, ino); |
| 978 | } | 979 | } |
| 979 | |||
| 980 | EXPORT_SYMBOL(ilookup); | 980 | EXPORT_SYMBOL(ilookup); |
| 981 | 981 | ||
| 982 | /** | 982 | /** |
| @@ -1015,7 +1015,6 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, | |||
| 1015 | */ | 1015 | */ |
| 1016 | return get_new_inode(sb, head, test, set, data); | 1016 | return get_new_inode(sb, head, test, set, data); |
| 1017 | } | 1017 | } |
| 1018 | |||
| 1019 | EXPORT_SYMBOL(iget5_locked); | 1018 | EXPORT_SYMBOL(iget5_locked); |
| 1020 | 1019 | ||
| 1021 | /** | 1020 | /** |
| @@ -1047,7 +1046,6 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino) | |||
| 1047 | */ | 1046 | */ |
| 1048 | return get_new_inode_fast(sb, head, ino); | 1047 | return get_new_inode_fast(sb, head, ino); |
| 1049 | } | 1048 | } |
| 1050 | |||
| 1051 | EXPORT_SYMBOL(iget_locked); | 1049 | EXPORT_SYMBOL(iget_locked); |
| 1052 | 1050 | ||
| 1053 | int insert_inode_locked(struct inode *inode) | 1051 | int insert_inode_locked(struct inode *inode) |
| @@ -1076,7 +1074,6 @@ int insert_inode_locked(struct inode *inode) | |||
| 1076 | iput(old); | 1074 | iput(old); |
| 1077 | } | 1075 | } |
| 1078 | } | 1076 | } |
| 1079 | |||
| 1080 | EXPORT_SYMBOL(insert_inode_locked); | 1077 | EXPORT_SYMBOL(insert_inode_locked); |
| 1081 | 1078 | ||
| 1082 | int insert_inode_locked4(struct inode *inode, unsigned long hashval, | 1079 | int insert_inode_locked4(struct inode *inode, unsigned long hashval, |
| @@ -1106,7 +1103,6 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval, | |||
| 1106 | iput(old); | 1103 | iput(old); |
| 1107 | } | 1104 | } |
| 1108 | } | 1105 | } |
| 1109 | |||
| 1110 | EXPORT_SYMBOL(insert_inode_locked4); | 1106 | EXPORT_SYMBOL(insert_inode_locked4); |
| 1111 | 1107 | ||
| 1112 | /** | 1108 | /** |
| @@ -1124,7 +1120,6 @@ void __insert_inode_hash(struct inode *inode, unsigned long hashval) | |||
| 1124 | hlist_add_head(&inode->i_hash, head); | 1120 | hlist_add_head(&inode->i_hash, head); |
| 1125 | spin_unlock(&inode_lock); | 1121 | spin_unlock(&inode_lock); |
| 1126 | } | 1122 | } |
| 1127 | |||
| 1128 | EXPORT_SYMBOL(__insert_inode_hash); | 1123 | EXPORT_SYMBOL(__insert_inode_hash); |
| 1129 | 1124 | ||
| 1130 | /** | 1125 | /** |
| @@ -1139,7 +1134,6 @@ void remove_inode_hash(struct inode *inode) | |||
| 1139 | hlist_del_init(&inode->i_hash); | 1134 | hlist_del_init(&inode->i_hash); |
| 1140 | spin_unlock(&inode_lock); | 1135 | spin_unlock(&inode_lock); |
| 1141 | } | 1136 | } |
| 1142 | |||
| 1143 | EXPORT_SYMBOL(remove_inode_hash); | 1137 | EXPORT_SYMBOL(remove_inode_hash); |
| 1144 | 1138 | ||
| 1145 | /* | 1139 | /* |
| @@ -1187,7 +1181,6 @@ void generic_delete_inode(struct inode *inode) | |||
| 1187 | BUG_ON(inode->i_state != I_CLEAR); | 1181 | BUG_ON(inode->i_state != I_CLEAR); |
| 1188 | destroy_inode(inode); | 1182 | destroy_inode(inode); |
| 1189 | } | 1183 | } |
| 1190 | |||
| 1191 | EXPORT_SYMBOL(generic_delete_inode); | 1184 | EXPORT_SYMBOL(generic_delete_inode); |
| 1192 | 1185 | ||
| 1193 | static void generic_forget_inode(struct inode *inode) | 1186 | static void generic_forget_inode(struct inode *inode) |
| @@ -1237,12 +1230,11 @@ void generic_drop_inode(struct inode *inode) | |||
| 1237 | else | 1230 | else |
| 1238 | generic_forget_inode(inode); | 1231 | generic_forget_inode(inode); |
| 1239 | } | 1232 | } |
| 1240 | |||
| 1241 | EXPORT_SYMBOL_GPL(generic_drop_inode); | 1233 | EXPORT_SYMBOL_GPL(generic_drop_inode); |
| 1242 | 1234 | ||
| 1243 | /* | 1235 | /* |
| 1244 | * Called when we're dropping the last reference | 1236 | * Called when we're dropping the last reference |
| 1245 | * to an inode. | 1237 | * to an inode. |
| 1246 | * | 1238 | * |
| 1247 | * Call the FS "drop()" function, defaulting to | 1239 | * Call the FS "drop()" function, defaulting to |
| 1248 | * the legacy UNIX filesystem behaviour.. | 1240 | * the legacy UNIX filesystem behaviour.. |
| @@ -1262,7 +1254,7 @@ static inline void iput_final(struct inode *inode) | |||
| 1262 | } | 1254 | } |
| 1263 | 1255 | ||
| 1264 | /** | 1256 | /** |
| 1265 | * iput - put an inode | 1257 | * iput - put an inode |
| 1266 | * @inode: inode to put | 1258 | * @inode: inode to put |
| 1267 | * | 1259 | * |
| 1268 | * Puts an inode, dropping its usage count. If the inode use count hits | 1260 | * Puts an inode, dropping its usage count. If the inode use count hits |
| @@ -1279,7 +1271,6 @@ void iput(struct inode *inode) | |||
| 1279 | iput_final(inode); | 1271 | iput_final(inode); |
| 1280 | } | 1272 | } |
| 1281 | } | 1273 | } |
| 1282 | |||
| 1283 | EXPORT_SYMBOL(iput); | 1274 | EXPORT_SYMBOL(iput); |
| 1284 | 1275 | ||
| 1285 | /** | 1276 | /** |
| @@ -1290,10 +1281,10 @@ EXPORT_SYMBOL(iput); | |||
| 1290 | * Returns the block number on the device holding the inode that | 1281 | * Returns the block number on the device holding the inode that |
| 1291 | * is the disk block number for the block of the file requested. | 1282 | * is the disk block number for the block of the file requested. |
| 1292 | * That is, asked for block 4 of inode 1 the function will return the | 1283 | * That is, asked for block 4 of inode 1 the function will return the |
| 1293 | * disk block relative to the disk start that holds that block of the | 1284 | * disk block relative to the disk start that holds that block of the |
| 1294 | * file. | 1285 | * file. |
| 1295 | */ | 1286 | */ |
| 1296 | sector_t bmap(struct inode * inode, sector_t block) | 1287 | sector_t bmap(struct inode *inode, sector_t block) |
| 1297 | { | 1288 | { |
| 1298 | sector_t res = 0; | 1289 | sector_t res = 0; |
| 1299 | if (inode->i_mapping->a_ops->bmap) | 1290 | if (inode->i_mapping->a_ops->bmap) |
| @@ -1425,7 +1416,6 @@ void file_update_time(struct file *file) | |||
| 1425 | mark_inode_dirty_sync(inode); | 1416 | mark_inode_dirty_sync(inode); |
| 1426 | mnt_drop_write(file->f_path.mnt); | 1417 | mnt_drop_write(file->f_path.mnt); |
| 1427 | } | 1418 | } |
| 1428 | |||
| 1429 | EXPORT_SYMBOL(file_update_time); | 1419 | EXPORT_SYMBOL(file_update_time); |
| 1430 | 1420 | ||
| 1431 | int inode_needs_sync(struct inode *inode) | 1421 | int inode_needs_sync(struct inode *inode) |
| @@ -1436,7 +1426,6 @@ int inode_needs_sync(struct inode *inode) | |||
| 1436 | return 1; | 1426 | return 1; |
| 1437 | return 0; | 1427 | return 0; |
| 1438 | } | 1428 | } |
| 1439 | |||
| 1440 | EXPORT_SYMBOL(inode_needs_sync); | 1429 | EXPORT_SYMBOL(inode_needs_sync); |
| 1441 | 1430 | ||
| 1442 | int inode_wait(void *word) | 1431 | int inode_wait(void *word) |
diff --git a/fs/libfs.c b/fs/libfs.c index cd223190c4e9..80046ddf5063 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
| @@ -246,8 +246,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
| 246 | return 0; | 246 | return 0; |
| 247 | 247 | ||
| 248 | Enomem: | 248 | Enomem: |
| 249 | up_write(&s->s_umount); | 249 | deactivate_locked_super(s); |
| 250 | deactivate_super(s); | ||
| 251 | return -ENOMEM; | 250 | return -ENOMEM; |
| 252 | } | 251 | } |
| 253 | 252 | ||
diff --git a/fs/namei.c b/fs/namei.c index 78f253cd2d4f..967c3db92724 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1130,8 +1130,8 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, | |||
| 1130 | * @nd: pointer to nameidata | 1130 | * @nd: pointer to nameidata |
| 1131 | * @open_flags: open intent flags | 1131 | * @open_flags: open intent flags |
| 1132 | */ | 1132 | */ |
| 1133 | int path_lookup_open(int dfd, const char *name, unsigned int lookup_flags, | 1133 | static int path_lookup_open(int dfd, const char *name, |
| 1134 | struct nameidata *nd, int open_flags) | 1134 | unsigned int lookup_flags, struct nameidata *nd, int open_flags) |
| 1135 | { | 1135 | { |
| 1136 | struct file *filp = get_empty_filp(); | 1136 | struct file *filp = get_empty_filp(); |
| 1137 | int err; | 1137 | int err; |
| @@ -1637,18 +1637,19 @@ static int open_will_write_to_fs(int flag, struct inode *inode) | |||
| 1637 | * open_to_namei_flags() for more details. | 1637 | * open_to_namei_flags() for more details. |
| 1638 | */ | 1638 | */ |
| 1639 | struct file *do_filp_open(int dfd, const char *pathname, | 1639 | struct file *do_filp_open(int dfd, const char *pathname, |
| 1640 | int open_flag, int mode) | 1640 | int open_flag, int mode, int acc_mode) |
| 1641 | { | 1641 | { |
| 1642 | struct file *filp; | 1642 | struct file *filp; |
| 1643 | struct nameidata nd; | 1643 | struct nameidata nd; |
| 1644 | int acc_mode, error; | 1644 | int error; |
| 1645 | struct path path; | 1645 | struct path path; |
| 1646 | struct dentry *dir; | 1646 | struct dentry *dir; |
| 1647 | int count = 0; | 1647 | int count = 0; |
| 1648 | int will_write; | 1648 | int will_write; |
| 1649 | int flag = open_to_namei_flags(open_flag); | 1649 | int flag = open_to_namei_flags(open_flag); |
| 1650 | 1650 | ||
| 1651 | acc_mode = MAY_OPEN | ACC_MODE(flag); | 1651 | if (!acc_mode) |
| 1652 | acc_mode = MAY_OPEN | ACC_MODE(flag); | ||
| 1652 | 1653 | ||
| 1653 | /* O_TRUNC implies we need access checks for write permissions */ | 1654 | /* O_TRUNC implies we need access checks for write permissions */ |
| 1654 | if (flag & O_TRUNC) | 1655 | if (flag & O_TRUNC) |
| @@ -1869,7 +1870,7 @@ do_link: | |||
| 1869 | */ | 1870 | */ |
| 1870 | struct file *filp_open(const char *filename, int flags, int mode) | 1871 | struct file *filp_open(const char *filename, int flags, int mode) |
| 1871 | { | 1872 | { |
| 1872 | return do_filp_open(AT_FDCWD, filename, flags, mode); | 1873 | return do_filp_open(AT_FDCWD, filename, flags, mode, 0); |
| 1873 | } | 1874 | } |
| 1874 | EXPORT_SYMBOL(filp_open); | 1875 | EXPORT_SYMBOL(filp_open); |
| 1875 | 1876 | ||
diff --git a/fs/namespace.c b/fs/namespace.c index 41196209a906..134d494158d9 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
| @@ -695,12 +695,16 @@ static inline void mangle(struct seq_file *m, const char *s) | |||
| 695 | */ | 695 | */ |
| 696 | int generic_show_options(struct seq_file *m, struct vfsmount *mnt) | 696 | int generic_show_options(struct seq_file *m, struct vfsmount *mnt) |
| 697 | { | 697 | { |
| 698 | const char *options = mnt->mnt_sb->s_options; | 698 | const char *options; |
| 699 | |||
| 700 | rcu_read_lock(); | ||
| 701 | options = rcu_dereference(mnt->mnt_sb->s_options); | ||
| 699 | 702 | ||
| 700 | if (options != NULL && options[0]) { | 703 | if (options != NULL && options[0]) { |
| 701 | seq_putc(m, ','); | 704 | seq_putc(m, ','); |
| 702 | mangle(m, options); | 705 | mangle(m, options); |
| 703 | } | 706 | } |
| 707 | rcu_read_unlock(); | ||
| 704 | 708 | ||
| 705 | return 0; | 709 | return 0; |
| 706 | } | 710 | } |
| @@ -721,11 +725,22 @@ EXPORT_SYMBOL(generic_show_options); | |||
| 721 | */ | 725 | */ |
| 722 | void save_mount_options(struct super_block *sb, char *options) | 726 | void save_mount_options(struct super_block *sb, char *options) |
| 723 | { | 727 | { |
| 724 | kfree(sb->s_options); | 728 | BUG_ON(sb->s_options); |
| 725 | sb->s_options = kstrdup(options, GFP_KERNEL); | 729 | rcu_assign_pointer(sb->s_options, kstrdup(options, GFP_KERNEL)); |
| 726 | } | 730 | } |
| 727 | EXPORT_SYMBOL(save_mount_options); | 731 | EXPORT_SYMBOL(save_mount_options); |
| 728 | 732 | ||
| 733 | void replace_mount_options(struct super_block *sb, char *options) | ||
| 734 | { | ||
| 735 | char *old = sb->s_options; | ||
| 736 | rcu_assign_pointer(sb->s_options, options); | ||
| 737 | if (old) { | ||
| 738 | synchronize_rcu(); | ||
| 739 | kfree(old); | ||
| 740 | } | ||
| 741 | } | ||
| 742 | EXPORT_SYMBOL(replace_mount_options); | ||
| 743 | |||
| 729 | #ifdef CONFIG_PROC_FS | 744 | #ifdef CONFIG_PROC_FS |
| 730 | /* iterator */ | 745 | /* iterator */ |
| 731 | static void *m_start(struct seq_file *m, loff_t *pos) | 746 | static void *m_start(struct seq_file *m, loff_t *pos) |
| @@ -1073,9 +1088,7 @@ static int do_umount(struct vfsmount *mnt, int flags) | |||
| 1073 | */ | 1088 | */ |
| 1074 | 1089 | ||
| 1075 | if (flags & MNT_FORCE && sb->s_op->umount_begin) { | 1090 | if (flags & MNT_FORCE && sb->s_op->umount_begin) { |
| 1076 | lock_kernel(); | ||
| 1077 | sb->s_op->umount_begin(sb); | 1091 | sb->s_op->umount_begin(sb); |
| 1078 | unlock_kernel(); | ||
| 1079 | } | 1092 | } |
| 1080 | 1093 | ||
| 1081 | /* | 1094 | /* |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 6717200923fe..d2d67781c579 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -683,9 +683,12 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt) | |||
| 683 | */ | 683 | */ |
| 684 | static void nfs_umount_begin(struct super_block *sb) | 684 | static void nfs_umount_begin(struct super_block *sb) |
| 685 | { | 685 | { |
| 686 | struct nfs_server *server = NFS_SB(sb); | 686 | struct nfs_server *server; |
| 687 | struct rpc_clnt *rpc; | 687 | struct rpc_clnt *rpc; |
| 688 | 688 | ||
| 689 | lock_kernel(); | ||
| 690 | |||
| 691 | server = NFS_SB(sb); | ||
| 689 | /* -EIO all pending I/O */ | 692 | /* -EIO all pending I/O */ |
| 690 | rpc = server->client_acl; | 693 | rpc = server->client_acl; |
| 691 | if (!IS_ERR(rpc)) | 694 | if (!IS_ERR(rpc)) |
| @@ -693,6 +696,8 @@ static void nfs_umount_begin(struct super_block *sb) | |||
| 693 | rpc = server->client; | 696 | rpc = server->client; |
| 694 | if (!IS_ERR(rpc)) | 697 | if (!IS_ERR(rpc)) |
| 695 | rpc_killall_tasks(rpc); | 698 | rpc_killall_tasks(rpc); |
| 699 | |||
| 700 | unlock_kernel(); | ||
| 696 | } | 701 | } |
| 697 | 702 | ||
| 698 | /* | 703 | /* |
| @@ -2106,8 +2111,7 @@ out_err_nosb: | |||
| 2106 | error_splat_root: | 2111 | error_splat_root: |
| 2107 | dput(mntroot); | 2112 | dput(mntroot); |
| 2108 | error_splat_super: | 2113 | error_splat_super: |
| 2109 | up_write(&s->s_umount); | 2114 | deactivate_locked_super(s); |
| 2110 | deactivate_super(s); | ||
| 2111 | goto out; | 2115 | goto out; |
| 2112 | } | 2116 | } |
| 2113 | 2117 | ||
| @@ -2203,8 +2207,7 @@ out_err_noserver: | |||
| 2203 | return error; | 2207 | return error; |
| 2204 | 2208 | ||
| 2205 | error_splat_super: | 2209 | error_splat_super: |
| 2206 | up_write(&s->s_umount); | 2210 | deactivate_locked_super(s); |
| 2207 | deactivate_super(s); | ||
| 2208 | dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); | 2211 | dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); |
| 2209 | return error; | 2212 | return error; |
| 2210 | } | 2213 | } |
| @@ -2464,8 +2467,7 @@ out_free: | |||
| 2464 | error_splat_root: | 2467 | error_splat_root: |
| 2465 | dput(mntroot); | 2468 | dput(mntroot); |
| 2466 | error_splat_super: | 2469 | error_splat_super: |
| 2467 | up_write(&s->s_umount); | 2470 | deactivate_locked_super(s); |
| 2468 | deactivate_super(s); | ||
| 2469 | goto out; | 2471 | goto out; |
| 2470 | } | 2472 | } |
| 2471 | 2473 | ||
| @@ -2559,8 +2561,7 @@ out_err_noserver: | |||
| 2559 | return error; | 2561 | return error; |
| 2560 | 2562 | ||
| 2561 | error_splat_super: | 2563 | error_splat_super: |
| 2562 | up_write(&s->s_umount); | 2564 | deactivate_locked_super(s); |
| 2563 | deactivate_super(s); | ||
| 2564 | dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); | 2565 | dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); |
| 2565 | return error; | 2566 | return error; |
| 2566 | } | 2567 | } |
| @@ -2644,8 +2645,7 @@ out_err_noserver: | |||
| 2644 | return error; | 2645 | return error; |
| 2645 | 2646 | ||
| 2646 | error_splat_super: | 2647 | error_splat_super: |
| 2647 | up_write(&s->s_umount); | 2648 | deactivate_locked_super(s); |
| 2648 | deactivate_super(s); | ||
| 2649 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); | 2649 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); |
| 2650 | return error; | 2650 | return error; |
| 2651 | } | 2651 | } |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index ed0a0cfd68d2..579dd1b1110f 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <linux/pagemap.h> | 40 | #include <linux/pagemap.h> |
| 41 | #include <linux/utsname.h> | 41 | #include <linux/utsname.h> |
| 42 | #include <linux/namei.h> | ||
| 42 | 43 | ||
| 43 | #define MLOG_MASK_PREFIX ML_NAMEI | 44 | #define MLOG_MASK_PREFIX ML_NAMEI |
| 44 | #include <cluster/masklog.h> | 45 | #include <cluster/masklog.h> |
| @@ -54,26 +55,6 @@ | |||
| 54 | 55 | ||
| 55 | #include "buffer_head_io.h" | 56 | #include "buffer_head_io.h" |
| 56 | 57 | ||
| 57 | static char *ocfs2_page_getlink(struct dentry * dentry, | ||
| 58 | struct page **ppage); | ||
| 59 | static char *ocfs2_fast_symlink_getlink(struct inode *inode, | ||
| 60 | struct buffer_head **bh); | ||
| 61 | |||
| 62 | /* get the link contents into pagecache */ | ||
| 63 | static char *ocfs2_page_getlink(struct dentry * dentry, | ||
| 64 | struct page **ppage) | ||
| 65 | { | ||
| 66 | struct page * page; | ||
| 67 | struct address_space *mapping = dentry->d_inode->i_mapping; | ||
| 68 | page = read_mapping_page(mapping, 0, NULL); | ||
| 69 | if (IS_ERR(page)) | ||
| 70 | goto sync_fail; | ||
| 71 | *ppage = page; | ||
| 72 | return kmap(page); | ||
| 73 | |||
| 74 | sync_fail: | ||
| 75 | return (char*)page; | ||
| 76 | } | ||
| 77 | 58 | ||
| 78 | static char *ocfs2_fast_symlink_getlink(struct inode *inode, | 59 | static char *ocfs2_fast_symlink_getlink(struct inode *inode, |
| 79 | struct buffer_head **bh) | 60 | struct buffer_head **bh) |
| @@ -128,40 +109,55 @@ out: | |||
| 128 | return ret; | 109 | return ret; |
| 129 | } | 110 | } |
| 130 | 111 | ||
| 131 | static void *ocfs2_follow_link(struct dentry *dentry, | 112 | static void *ocfs2_fast_follow_link(struct dentry *dentry, |
| 132 | struct nameidata *nd) | 113 | struct nameidata *nd) |
| 133 | { | 114 | { |
| 134 | int status; | 115 | int status = 0; |
| 135 | char *link; | 116 | int len; |
| 117 | char *target, *link = ERR_PTR(-ENOMEM); | ||
| 136 | struct inode *inode = dentry->d_inode; | 118 | struct inode *inode = dentry->d_inode; |
| 137 | struct page *page = NULL; | ||
| 138 | struct buffer_head *bh = NULL; | 119 | struct buffer_head *bh = NULL; |
| 139 | 120 | ||
| 140 | if (ocfs2_inode_is_fast_symlink(inode)) | 121 | mlog_entry_void(); |
| 141 | link = ocfs2_fast_symlink_getlink(inode, &bh); | 122 | |
| 142 | else | 123 | BUG_ON(!ocfs2_inode_is_fast_symlink(inode)); |
| 143 | link = ocfs2_page_getlink(dentry, &page); | 124 | target = ocfs2_fast_symlink_getlink(inode, &bh); |
| 144 | if (IS_ERR(link)) { | 125 | if (IS_ERR(target)) { |
| 145 | status = PTR_ERR(link); | 126 | status = PTR_ERR(target); |
| 146 | mlog_errno(status); | 127 | mlog_errno(status); |
| 147 | goto bail; | 128 | goto bail; |
| 148 | } | 129 | } |
| 149 | 130 | ||
| 150 | status = vfs_follow_link(nd, link); | 131 | /* Fast symlinks can't be large */ |
| 132 | len = strlen(target); | ||
| 133 | link = kzalloc(len + 1, GFP_NOFS); | ||
| 134 | if (!link) { | ||
| 135 | status = -ENOMEM; | ||
| 136 | mlog_errno(status); | ||
| 137 | goto bail; | ||
| 138 | } | ||
| 139 | |||
| 140 | memcpy(link, target, len); | ||
| 141 | nd_set_link(nd, link); | ||
| 151 | 142 | ||
| 152 | bail: | 143 | bail: |
| 153 | if (page) { | ||
| 154 | kunmap(page); | ||
| 155 | page_cache_release(page); | ||
| 156 | } | ||
| 157 | brelse(bh); | 144 | brelse(bh); |
| 158 | 145 | ||
| 159 | return ERR_PTR(status); | 146 | mlog_exit(status); |
| 147 | return status ? ERR_PTR(status) : link; | ||
| 148 | } | ||
| 149 | |||
| 150 | static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) | ||
| 151 | { | ||
| 152 | char *link = cookie; | ||
| 153 | |||
| 154 | kfree(link); | ||
| 160 | } | 155 | } |
| 161 | 156 | ||
| 162 | const struct inode_operations ocfs2_symlink_inode_operations = { | 157 | const struct inode_operations ocfs2_symlink_inode_operations = { |
| 163 | .readlink = page_readlink, | 158 | .readlink = page_readlink, |
| 164 | .follow_link = ocfs2_follow_link, | 159 | .follow_link = page_follow_link_light, |
| 160 | .put_link = page_put_link, | ||
| 165 | .getattr = ocfs2_getattr, | 161 | .getattr = ocfs2_getattr, |
| 166 | .setattr = ocfs2_setattr, | 162 | .setattr = ocfs2_setattr, |
| 167 | .setxattr = generic_setxattr, | 163 | .setxattr = generic_setxattr, |
| @@ -171,7 +167,8 @@ const struct inode_operations ocfs2_symlink_inode_operations = { | |||
| 171 | }; | 167 | }; |
| 172 | const struct inode_operations ocfs2_fast_symlink_inode_operations = { | 168 | const struct inode_operations ocfs2_fast_symlink_inode_operations = { |
| 173 | .readlink = ocfs2_readlink, | 169 | .readlink = ocfs2_readlink, |
| 174 | .follow_link = ocfs2_follow_link, | 170 | .follow_link = ocfs2_fast_follow_link, |
| 171 | .put_link = ocfs2_fast_put_link, | ||
| 175 | .getattr = ocfs2_getattr, | 172 | .getattr = ocfs2_getattr, |
| 176 | .setattr = ocfs2_setattr, | 173 | .setattr = ocfs2_setattr, |
| 177 | .setxattr = generic_setxattr, | 174 | .setxattr = generic_setxattr, |
| @@ -1033,7 +1033,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode) | |||
| 1033 | if (!IS_ERR(tmp)) { | 1033 | if (!IS_ERR(tmp)) { |
| 1034 | fd = get_unused_fd_flags(flags); | 1034 | fd = get_unused_fd_flags(flags); |
| 1035 | if (fd >= 0) { | 1035 | if (fd >= 0) { |
| 1036 | struct file *f = do_filp_open(dfd, tmp, flags, mode); | 1036 | struct file *f = do_filp_open(dfd, tmp, flags, mode, 0); |
| 1037 | if (IS_ERR(f)) { | 1037 | if (IS_ERR(f)) { |
| 1038 | put_unused_fd(fd); | 1038 | put_unused_fd(fd); |
| 1039 | fd = PTR_ERR(f); | 1039 | fd = PTR_ERR(f); |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 1e15a2b176e8..b080b791d9e3 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
| @@ -67,8 +67,7 @@ static int proc_get_sb(struct file_system_type *fs_type, | |||
| 67 | sb->s_flags = flags; | 67 | sb->s_flags = flags; |
| 68 | err = proc_fill_super(sb); | 68 | err = proc_fill_super(sb); |
| 69 | if (err) { | 69 | if (err) { |
| 70 | up_write(&sb->s_umount); | 70 | deactivate_locked_super(sb); |
| 71 | deactivate_super(sb); | ||
| 72 | return err; | 71 | return err; |
| 73 | } | 72 | } |
| 74 | 73 | ||
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 67a80d7e59e2..45ee3d357c70 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
| @@ -41,6 +41,18 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, | |||
| 41 | 41 | ||
| 42 | #define store_ih(where,what) copy_item_head (where, what) | 42 | #define store_ih(where,what) copy_item_head (where, what) |
| 43 | 43 | ||
| 44 | static inline bool is_privroot_deh(struct dentry *dir, | ||
| 45 | struct reiserfs_de_head *deh) | ||
| 46 | { | ||
| 47 | int ret = 0; | ||
| 48 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
| 49 | struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root; | ||
| 50 | ret = (dir == dir->d_parent && privroot->d_inode && | ||
| 51 | deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid); | ||
| 52 | #endif | ||
| 53 | return ret; | ||
| 54 | } | ||
| 55 | |||
| 44 | int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, | 56 | int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, |
| 45 | filldir_t filldir, loff_t *pos) | 57 | filldir_t filldir, loff_t *pos) |
| 46 | { | 58 | { |
| @@ -138,18 +150,8 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, | |||
| 138 | } | 150 | } |
| 139 | 151 | ||
| 140 | /* Ignore the .reiserfs_priv entry */ | 152 | /* Ignore the .reiserfs_priv entry */ |
| 141 | if (reiserfs_xattrs(inode->i_sb) && | 153 | if (is_privroot_deh(dentry, deh)) |
| 142 | !old_format_only(inode->i_sb) && | ||
| 143 | dentry == inode->i_sb->s_root && | ||
| 144 | REISERFS_SB(inode->i_sb)->priv_root && | ||
| 145 | REISERFS_SB(inode->i_sb)->priv_root->d_inode | ||
| 146 | && deh_objectid(deh) == | ||
| 147 | le32_to_cpu(INODE_PKEY | ||
| 148 | (REISERFS_SB(inode->i_sb)-> | ||
| 149 | priv_root->d_inode)-> | ||
| 150 | k_objectid)) { | ||
| 151 | continue; | 154 | continue; |
| 152 | } | ||
| 153 | 155 | ||
| 154 | d_off = deh_offset(deh); | 156 | d_off = deh_offset(deh); |
| 155 | *pos = d_off; | 157 | *pos = d_off; |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index efd4d720718e..271579128634 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
| @@ -338,21 +338,8 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 338 | &path_to_entry, &de); | 338 | &path_to_entry, &de); |
| 339 | pathrelse(&path_to_entry); | 339 | pathrelse(&path_to_entry); |
| 340 | if (retval == NAME_FOUND) { | 340 | if (retval == NAME_FOUND) { |
| 341 | /* Hide the .reiserfs_priv directory */ | 341 | inode = reiserfs_iget(dir->i_sb, |
| 342 | if (reiserfs_xattrs(dir->i_sb) && | 342 | (struct cpu_key *)&(de.de_dir_id)); |
| 343 | !old_format_only(dir->i_sb) && | ||
| 344 | REISERFS_SB(dir->i_sb)->priv_root && | ||
| 345 | REISERFS_SB(dir->i_sb)->priv_root->d_inode && | ||
| 346 | de.de_objectid == | ||
| 347 | le32_to_cpu(INODE_PKEY | ||
| 348 | (REISERFS_SB(dir->i_sb)->priv_root->d_inode)-> | ||
| 349 | k_objectid)) { | ||
| 350 | reiserfs_write_unlock(dir->i_sb); | ||
| 351 | return ERR_PTR(-EACCES); | ||
| 352 | } | ||
| 353 | |||
| 354 | inode = | ||
| 355 | reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id)); | ||
| 356 | if (!inode || IS_ERR(inode)) { | 343 | if (!inode || IS_ERR(inode)) { |
| 357 | reiserfs_write_unlock(dir->i_sb); | 344 | reiserfs_write_unlock(dir->i_sb); |
| 358 | return ERR_PTR(-EACCES); | 345 | return ERR_PTR(-EACCES); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 0ae6486d9046..1215a4f50cd2 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
| @@ -1316,8 +1316,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
| 1316 | } | 1316 | } |
| 1317 | 1317 | ||
| 1318 | out_ok: | 1318 | out_ok: |
| 1319 | kfree(s->s_options); | 1319 | replace_mount_options(s, new_opts); |
| 1320 | s->s_options = new_opts; | ||
| 1321 | return 0; | 1320 | return 0; |
| 1322 | 1321 | ||
| 1323 | out_err: | 1322 | out_err: |
| @@ -1842,7 +1841,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
| 1842 | goto error; | 1841 | goto error; |
| 1843 | } | 1842 | } |
| 1844 | 1843 | ||
| 1845 | if ((errval = reiserfs_xattr_init(s, s->s_flags))) { | 1844 | if ((errval = reiserfs_lookup_privroot(s)) || |
| 1845 | (errval = reiserfs_xattr_init(s, s->s_flags))) { | ||
| 1846 | dput(s->s_root); | 1846 | dput(s->s_root); |
| 1847 | s->s_root = NULL; | 1847 | s->s_root = NULL; |
| 1848 | goto error; | 1848 | goto error; |
| @@ -1855,7 +1855,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
| 1855 | reiserfs_info(s, "using 3.5.x disk format\n"); | 1855 | reiserfs_info(s, "using 3.5.x disk format\n"); |
| 1856 | } | 1856 | } |
| 1857 | 1857 | ||
| 1858 | if ((errval = reiserfs_xattr_init(s, s->s_flags))) { | 1858 | if ((errval = reiserfs_lookup_privroot(s)) || |
| 1859 | (errval = reiserfs_xattr_init(s, s->s_flags))) { | ||
| 1859 | dput(s->s_root); | 1860 | dput(s->s_root); |
| 1860 | s->s_root = NULL; | 1861 | s->s_root = NULL; |
| 1861 | goto error; | 1862 | goto error; |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index f83f52bae390..2237e10c7c7c 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
| @@ -113,41 +113,28 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 113 | 113 | ||
| 114 | #define xattr_may_create(flags) (!flags || flags & XATTR_CREATE) | 114 | #define xattr_may_create(flags) (!flags || flags & XATTR_CREATE) |
| 115 | 115 | ||
| 116 | /* Returns and possibly creates the xattr dir. */ | 116 | static struct dentry *open_xa_root(struct super_block *sb, int flags) |
| 117 | static struct dentry *lookup_or_create_dir(struct dentry *parent, | ||
| 118 | const char *name, int flags) | ||
| 119 | { | 117 | { |
| 120 | struct dentry *dentry; | 118 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; |
| 121 | BUG_ON(!parent); | 119 | struct dentry *xaroot; |
| 120 | if (!privroot->d_inode) | ||
| 121 | return ERR_PTR(-ENODATA); | ||
| 122 | 122 | ||
| 123 | dentry = lookup_one_len(name, parent, strlen(name)); | 123 | mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR); |
| 124 | if (IS_ERR(dentry)) | ||
| 125 | return dentry; | ||
| 126 | else if (!dentry->d_inode) { | ||
| 127 | int err = -ENODATA; | ||
| 128 | |||
| 129 | if (xattr_may_create(flags)) { | ||
| 130 | mutex_lock_nested(&parent->d_inode->i_mutex, | ||
| 131 | I_MUTEX_XATTR); | ||
| 132 | err = xattr_mkdir(parent->d_inode, dentry, 0700); | ||
| 133 | mutex_unlock(&parent->d_inode->i_mutex); | ||
| 134 | } | ||
| 135 | 124 | ||
| 125 | xaroot = dget(REISERFS_SB(sb)->xattr_root); | ||
| 126 | if (!xaroot->d_inode) { | ||
| 127 | int err = -ENODATA; | ||
| 128 | if (xattr_may_create(flags)) | ||
| 129 | err = xattr_mkdir(privroot->d_inode, xaroot, 0700); | ||
| 136 | if (err) { | 130 | if (err) { |
| 137 | dput(dentry); | 131 | dput(xaroot); |
| 138 | dentry = ERR_PTR(err); | 132 | xaroot = ERR_PTR(err); |
| 139 | } | 133 | } |
| 140 | } | 134 | } |
| 141 | 135 | ||
| 142 | return dentry; | 136 | mutex_unlock(&privroot->d_inode->i_mutex); |
| 143 | } | 137 | return xaroot; |
| 144 | |||
| 145 | static struct dentry *open_xa_root(struct super_block *sb, int flags) | ||
| 146 | { | ||
| 147 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; | ||
| 148 | if (!privroot) | ||
| 149 | return ERR_PTR(-ENODATA); | ||
| 150 | return lookup_or_create_dir(privroot, XAROOT_NAME, flags); | ||
| 151 | } | 138 | } |
| 152 | 139 | ||
| 153 | static struct dentry *open_xa_dir(const struct inode *inode, int flags) | 140 | static struct dentry *open_xa_dir(const struct inode *inode, int flags) |
| @@ -163,10 +150,22 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags) | |||
| 163 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), | 150 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), |
| 164 | inode->i_generation); | 151 | inode->i_generation); |
| 165 | 152 | ||
| 166 | xadir = lookup_or_create_dir(xaroot, namebuf, flags); | 153 | mutex_lock_nested(&xaroot->d_inode->i_mutex, I_MUTEX_XATTR); |
| 154 | |||
| 155 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); | ||
| 156 | if (!IS_ERR(xadir) && !xadir->d_inode) { | ||
| 157 | int err = -ENODATA; | ||
| 158 | if (xattr_may_create(flags)) | ||
| 159 | err = xattr_mkdir(xaroot->d_inode, xadir, 0700); | ||
| 160 | if (err) { | ||
| 161 | dput(xadir); | ||
| 162 | xadir = ERR_PTR(err); | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 166 | mutex_unlock(&xaroot->d_inode->i_mutex); | ||
| 167 | dput(xaroot); | 167 | dput(xaroot); |
| 168 | return xadir; | 168 | return xadir; |
| 169 | |||
| 170 | } | 169 | } |
| 171 | 170 | ||
| 172 | /* The following are side effects of other operations that aren't explicitly | 171 | /* The following are side effects of other operations that aren't explicitly |
| @@ -184,6 +183,7 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset, | |||
| 184 | { | 183 | { |
| 185 | struct reiserfs_dentry_buf *dbuf = buf; | 184 | struct reiserfs_dentry_buf *dbuf = buf; |
| 186 | struct dentry *dentry; | 185 | struct dentry *dentry; |
| 186 | WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); | ||
| 187 | 187 | ||
| 188 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) | 188 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) |
| 189 | return -ENOSPC; | 189 | return -ENOSPC; |
| @@ -349,6 +349,7 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
| 349 | if (IS_ERR(xadir)) | 349 | if (IS_ERR(xadir)) |
| 350 | return ERR_CAST(xadir); | 350 | return ERR_CAST(xadir); |
| 351 | 351 | ||
| 352 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | ||
| 352 | xafile = lookup_one_len(name, xadir, strlen(name)); | 353 | xafile = lookup_one_len(name, xadir, strlen(name)); |
| 353 | if (IS_ERR(xafile)) { | 354 | if (IS_ERR(xafile)) { |
| 354 | err = PTR_ERR(xafile); | 355 | err = PTR_ERR(xafile); |
| @@ -360,18 +361,15 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
| 360 | 361 | ||
| 361 | if (!xafile->d_inode) { | 362 | if (!xafile->d_inode) { |
| 362 | err = -ENODATA; | 363 | err = -ENODATA; |
| 363 | if (xattr_may_create(flags)) { | 364 | if (xattr_may_create(flags)) |
| 364 | mutex_lock_nested(&xadir->d_inode->i_mutex, | ||
| 365 | I_MUTEX_XATTR); | ||
| 366 | err = xattr_create(xadir->d_inode, xafile, | 365 | err = xattr_create(xadir->d_inode, xafile, |
| 367 | 0700|S_IFREG); | 366 | 0700|S_IFREG); |
| 368 | mutex_unlock(&xadir->d_inode->i_mutex); | ||
| 369 | } | ||
| 370 | } | 367 | } |
| 371 | 368 | ||
| 372 | if (err) | 369 | if (err) |
| 373 | dput(xafile); | 370 | dput(xafile); |
| 374 | out: | 371 | out: |
| 372 | mutex_unlock(&xadir->d_inode->i_mutex); | ||
| 375 | dput(xadir); | 373 | dput(xadir); |
| 376 | if (err) | 374 | if (err) |
| 377 | return ERR_PTR(err); | 375 | return ERR_PTR(err); |
| @@ -435,6 +433,7 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
| 435 | if (IS_ERR(xadir)) | 433 | if (IS_ERR(xadir)) |
| 436 | return PTR_ERR(xadir); | 434 | return PTR_ERR(xadir); |
| 437 | 435 | ||
| 436 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | ||
| 438 | dentry = lookup_one_len(name, xadir, strlen(name)); | 437 | dentry = lookup_one_len(name, xadir, strlen(name)); |
| 439 | if (IS_ERR(dentry)) { | 438 | if (IS_ERR(dentry)) { |
| 440 | err = PTR_ERR(dentry); | 439 | err = PTR_ERR(dentry); |
| @@ -442,14 +441,13 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | if (dentry->d_inode) { | 443 | if (dentry->d_inode) { |
| 445 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | ||
| 446 | err = xattr_unlink(xadir->d_inode, dentry); | 444 | err = xattr_unlink(xadir->d_inode, dentry); |
| 447 | mutex_unlock(&xadir->d_inode->i_mutex); | ||
| 448 | update_ctime(inode); | 445 | update_ctime(inode); |
| 449 | } | 446 | } |
| 450 | 447 | ||
| 451 | dput(dentry); | 448 | dput(dentry); |
| 452 | out_dput: | 449 | out_dput: |
| 450 | mutex_unlock(&xadir->d_inode->i_mutex); | ||
| 453 | dput(xadir); | 451 | dput(xadir); |
| 454 | return err; | 452 | return err; |
| 455 | } | 453 | } |
| @@ -843,7 +841,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
| 843 | if (!dentry->d_inode) | 841 | if (!dentry->d_inode) |
| 844 | return -EINVAL; | 842 | return -EINVAL; |
| 845 | 843 | ||
| 846 | if (!reiserfs_xattrs(dentry->d_sb) || | 844 | if (!dentry->d_sb->s_xattr || |
| 847 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 845 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) |
| 848 | return -EOPNOTSUPP; | 846 | return -EOPNOTSUPP; |
| 849 | 847 | ||
| @@ -906,19 +904,22 @@ static int create_privroot(struct dentry *dentry) | |||
| 906 | { | 904 | { |
| 907 | int err; | 905 | int err; |
| 908 | struct inode *inode = dentry->d_parent->d_inode; | 906 | struct inode *inode = dentry->d_parent->d_inode; |
| 909 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR); | 907 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); |
| 908 | |||
| 910 | err = xattr_mkdir(inode, dentry, 0700); | 909 | err = xattr_mkdir(inode, dentry, 0700); |
| 911 | mutex_unlock(&inode->i_mutex); | 910 | if (err || !dentry->d_inode) { |
| 912 | if (err) { | 911 | reiserfs_warning(dentry->d_sb, "jdm-20006", |
| 913 | dput(dentry); | 912 | "xattrs/ACLs enabled and couldn't " |
| 914 | dentry = NULL; | 913 | "find/create .reiserfs_priv. " |
| 914 | "Failing mount."); | ||
| 915 | return -EOPNOTSUPP; | ||
| 915 | } | 916 | } |
| 916 | 917 | ||
| 917 | if (dentry && dentry->d_inode) | 918 | dentry->d_inode->i_flags |= S_PRIVATE; |
| 918 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " | 919 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " |
| 919 | "storage.\n", PRIVROOT_NAME); | 920 | "storage.\n", PRIVROOT_NAME); |
| 920 | 921 | ||
| 921 | return err; | 922 | return 0; |
| 922 | } | 923 | } |
| 923 | 924 | ||
| 924 | static int xattr_mount_check(struct super_block *s) | 925 | static int xattr_mount_check(struct super_block *s) |
| @@ -950,11 +951,9 @@ static int | |||
| 950 | xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name) | 951 | xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name) |
| 951 | { | 952 | { |
| 952 | struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root; | 953 | struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root; |
| 953 | if (name->len == priv_root->d_name.len && | 954 | if (container_of(q1, struct dentry, d_name) == priv_root) |
| 954 | name->hash == priv_root->d_name.hash && | ||
| 955 | !memcmp(name->name, priv_root->d_name.name, name->len)) { | ||
| 956 | return -ENOENT; | 955 | return -ENOENT; |
| 957 | } else if (q1->len == name->len && | 956 | if (q1->len == name->len && |
| 958 | !memcmp(q1->name, name->name, name->len)) | 957 | !memcmp(q1->name, name->name, name->len)) |
| 959 | return 0; | 958 | return 0; |
| 960 | return 1; | 959 | return 1; |
| @@ -964,59 +963,60 @@ static const struct dentry_operations xattr_lookup_poison_ops = { | |||
| 964 | .d_compare = xattr_lookup_poison, | 963 | .d_compare = xattr_lookup_poison, |
| 965 | }; | 964 | }; |
| 966 | 965 | ||
| 966 | int reiserfs_lookup_privroot(struct super_block *s) | ||
| 967 | { | ||
| 968 | struct dentry *dentry; | ||
| 969 | int err = 0; | ||
| 970 | |||
| 971 | /* If we don't have the privroot located yet - go find it */ | ||
| 972 | mutex_lock(&s->s_root->d_inode->i_mutex); | ||
| 973 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, | ||
| 974 | strlen(PRIVROOT_NAME)); | ||
| 975 | if (!IS_ERR(dentry)) { | ||
| 976 | REISERFS_SB(s)->priv_root = dentry; | ||
| 977 | s->s_root->d_op = &xattr_lookup_poison_ops; | ||
| 978 | if (dentry->d_inode) | ||
| 979 | dentry->d_inode->i_flags |= S_PRIVATE; | ||
| 980 | } else | ||
| 981 | err = PTR_ERR(dentry); | ||
| 982 | mutex_unlock(&s->s_root->d_inode->i_mutex); | ||
| 983 | |||
| 984 | return err; | ||
| 985 | } | ||
| 986 | |||
| 967 | /* We need to take a copy of the mount flags since things like | 987 | /* We need to take a copy of the mount flags since things like |
| 968 | * MS_RDONLY don't get set until *after* we're called. | 988 | * MS_RDONLY don't get set until *after* we're called. |
| 969 | * mount_flags != mount_options */ | 989 | * mount_flags != mount_options */ |
| 970 | int reiserfs_xattr_init(struct super_block *s, int mount_flags) | 990 | int reiserfs_xattr_init(struct super_block *s, int mount_flags) |
| 971 | { | 991 | { |
| 972 | int err = 0; | 992 | int err = 0; |
| 993 | struct dentry *privroot = REISERFS_SB(s)->priv_root; | ||
| 973 | 994 | ||
| 974 | #ifdef CONFIG_REISERFS_FS_XATTR | 995 | #ifdef CONFIG_REISERFS_FS_XATTR |
| 975 | err = xattr_mount_check(s); | 996 | err = xattr_mount_check(s); |
| 976 | if (err) | 997 | if (err) |
| 977 | goto error; | 998 | goto error; |
| 978 | #endif | ||
| 979 | 999 | ||
| 980 | /* If we don't have the privroot located yet - go find it */ | 1000 | if (!privroot->d_inode && !(mount_flags & MS_RDONLY)) { |
| 981 | if (!REISERFS_SB(s)->priv_root) { | 1001 | mutex_lock(&s->s_root->d_inode->i_mutex); |
| 982 | struct dentry *dentry; | 1002 | err = create_privroot(REISERFS_SB(s)->priv_root); |
| 983 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, | 1003 | mutex_unlock(&s->s_root->d_inode->i_mutex); |
| 984 | strlen(PRIVROOT_NAME)); | ||
| 985 | if (!IS_ERR(dentry)) { | ||
| 986 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
| 987 | if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) | ||
| 988 | err = create_privroot(dentry); | ||
| 989 | #endif | ||
| 990 | if (!dentry->d_inode) { | ||
| 991 | dput(dentry); | ||
| 992 | dentry = NULL; | ||
| 993 | } | ||
| 994 | } else | ||
| 995 | err = PTR_ERR(dentry); | ||
| 996 | |||
| 997 | if (!err && dentry) { | ||
| 998 | s->s_root->d_op = &xattr_lookup_poison_ops; | ||
| 999 | dentry->d_inode->i_flags |= S_PRIVATE; | ||
| 1000 | REISERFS_SB(s)->priv_root = dentry; | ||
| 1001 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
| 1002 | /* xattrs are unavailable */ | ||
| 1003 | } else if (!(mount_flags & MS_RDONLY)) { | ||
| 1004 | /* If we're read-only it just means that the dir | ||
| 1005 | * hasn't been created. Not an error -- just no | ||
| 1006 | * xattrs on the fs. We'll check again if we | ||
| 1007 | * go read-write */ | ||
| 1008 | reiserfs_warning(s, "jdm-20006", | ||
| 1009 | "xattrs/ACLs enabled and couldn't " | ||
| 1010 | "find/create .reiserfs_priv. " | ||
| 1011 | "Failing mount."); | ||
| 1012 | err = -EOPNOTSUPP; | ||
| 1013 | #endif | ||
| 1014 | } | ||
| 1015 | } | 1004 | } |
| 1016 | 1005 | ||
| 1017 | #ifdef CONFIG_REISERFS_FS_XATTR | 1006 | if (privroot->d_inode) { |
| 1018 | if (!err) | ||
| 1019 | s->s_xattr = reiserfs_xattr_handlers; | 1007 | s->s_xattr = reiserfs_xattr_handlers; |
| 1008 | mutex_lock(&privroot->d_inode->i_mutex); | ||
| 1009 | if (!REISERFS_SB(s)->xattr_root) { | ||
| 1010 | struct dentry *dentry; | ||
| 1011 | dentry = lookup_one_len(XAROOT_NAME, privroot, | ||
| 1012 | strlen(XAROOT_NAME)); | ||
| 1013 | if (!IS_ERR(dentry)) | ||
| 1014 | REISERFS_SB(s)->xattr_root = dentry; | ||
| 1015 | else | ||
| 1016 | err = PTR_ERR(dentry); | ||
| 1017 | } | ||
| 1018 | mutex_unlock(&privroot->d_inode->i_mutex); | ||
| 1019 | } | ||
| 1020 | 1020 | ||
| 1021 | error: | 1021 | error: |
| 1022 | if (err) { | 1022 | if (err) { |
| @@ -1026,11 +1026,12 @@ error: | |||
| 1026 | #endif | 1026 | #endif |
| 1027 | 1027 | ||
| 1028 | /* The super_block MS_POSIXACL must mirror the (no)acl mount option. */ | 1028 | /* The super_block MS_POSIXACL must mirror the (no)acl mount option. */ |
| 1029 | s->s_flags = s->s_flags & ~MS_POSIXACL; | ||
| 1030 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 1029 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
| 1031 | if (reiserfs_posixacl(s)) | 1030 | if (reiserfs_posixacl(s)) |
| 1032 | s->s_flags |= MS_POSIXACL; | 1031 | s->s_flags |= MS_POSIXACL; |
| 1032 | else | ||
| 1033 | #endif | 1033 | #endif |
| 1034 | s->s_flags &= ~MS_POSIXACL; | ||
| 1034 | 1035 | ||
| 1035 | return err; | 1036 | return err; |
| 1036 | } | 1037 | } |
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 4d3c20e787c3..a92c8792c0f6 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
| @@ -55,8 +55,16 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode, | |||
| 55 | struct reiserfs_security_handle *sec) | 55 | struct reiserfs_security_handle *sec) |
| 56 | { | 56 | { |
| 57 | int blocks = 0; | 57 | int blocks = 0; |
| 58 | int error = security_inode_init_security(inode, dir, &sec->name, | 58 | int error; |
| 59 | &sec->value, &sec->length); | 59 | |
| 60 | sec->name = NULL; | ||
| 61 | |||
| 62 | /* Don't add selinux attributes on xattrs - they'll never get used */ | ||
| 63 | if (IS_PRIVATE(dir)) | ||
| 64 | return 0; | ||
| 65 | |||
| 66 | error = security_inode_init_security(inode, dir, &sec->name, | ||
| 67 | &sec->value, &sec->length); | ||
| 60 | if (error) { | 68 | if (error) { |
| 61 | if (error == -EOPNOTSUPP) | 69 | if (error == -EOPNOTSUPP) |
| 62 | error = 0; | 70 | error = 0; |
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index c53b5ef8a02f..4ab3c03d8f95 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c | |||
| @@ -298,7 +298,8 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos) | |||
| 298 | struct romfs_inode ri; | 298 | struct romfs_inode ri; |
| 299 | struct inode *i; | 299 | struct inode *i; |
| 300 | unsigned long nlen; | 300 | unsigned long nlen; |
| 301 | unsigned nextfh, ret; | 301 | unsigned nextfh; |
| 302 | int ret; | ||
| 302 | umode_t mode; | 303 | umode_t mode; |
| 303 | 304 | ||
| 304 | /* we might have to traverse a chain of "hard link" file entries to get | 305 | /* we might have to traverse a chain of "hard link" file entries to get |
diff --git a/fs/super.c b/fs/super.c index 786fe7d72790..1943fdf655fa 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -208,6 +208,34 @@ void deactivate_super(struct super_block *s) | |||
| 208 | EXPORT_SYMBOL(deactivate_super); | 208 | EXPORT_SYMBOL(deactivate_super); |
| 209 | 209 | ||
| 210 | /** | 210 | /** |
| 211 | * deactivate_locked_super - drop an active reference to superblock | ||
| 212 | * @s: superblock to deactivate | ||
| 213 | * | ||
| 214 | * Equivalent of up_write(&s->s_umount); deactivate_super(s);, except that | ||
| 215 | * it does not unlock it until it's all over. As the result, it's safe to | ||
| 216 | * use to dispose of new superblock on ->get_sb() failure exits - nobody | ||
| 217 | * will see the sucker until it's all over. Equivalent using up_write + | ||
| 218 | * deactivate_super is safe for that purpose only if superblock is either | ||
| 219 | * safe to use or has NULL ->s_root when we unlock. | ||
| 220 | */ | ||
| 221 | void deactivate_locked_super(struct super_block *s) | ||
| 222 | { | ||
| 223 | struct file_system_type *fs = s->s_type; | ||
| 224 | if (atomic_dec_and_lock(&s->s_active, &sb_lock)) { | ||
| 225 | s->s_count -= S_BIAS-1; | ||
| 226 | spin_unlock(&sb_lock); | ||
| 227 | vfs_dq_off(s, 0); | ||
| 228 | fs->kill_sb(s); | ||
| 229 | put_filesystem(fs); | ||
| 230 | put_super(s); | ||
| 231 | } else { | ||
| 232 | up_write(&s->s_umount); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 236 | EXPORT_SYMBOL(deactivate_locked_super); | ||
| 237 | |||
| 238 | /** | ||
| 211 | * grab_super - acquire an active reference | 239 | * grab_super - acquire an active reference |
| 212 | * @s: reference we are trying to make active | 240 | * @s: reference we are trying to make active |
| 213 | * | 241 | * |
| @@ -797,8 +825,7 @@ int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, | |||
| 797 | sb->s_flags = flags; | 825 | sb->s_flags = flags; |
| 798 | err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 826 | err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
| 799 | if (err) { | 827 | if (err) { |
| 800 | up_write(&sb->s_umount); | 828 | deactivate_locked_super(sb); |
| 801 | deactivate_super(sb); | ||
| 802 | return err; | 829 | return err; |
| 803 | } | 830 | } |
| 804 | 831 | ||
| @@ -854,8 +881,7 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
| 854 | 881 | ||
| 855 | if (s->s_root) { | 882 | if (s->s_root) { |
| 856 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 883 | if ((flags ^ s->s_flags) & MS_RDONLY) { |
| 857 | up_write(&s->s_umount); | 884 | deactivate_locked_super(s); |
| 858 | deactivate_super(s); | ||
| 859 | error = -EBUSY; | 885 | error = -EBUSY; |
| 860 | goto error_bdev; | 886 | goto error_bdev; |
| 861 | } | 887 | } |
| @@ -870,8 +896,7 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
| 870 | sb_set_blocksize(s, block_size(bdev)); | 896 | sb_set_blocksize(s, block_size(bdev)); |
| 871 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 897 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
| 872 | if (error) { | 898 | if (error) { |
| 873 | up_write(&s->s_umount); | 899 | deactivate_locked_super(s); |
| 874 | deactivate_super(s); | ||
| 875 | goto error; | 900 | goto error; |
| 876 | } | 901 | } |
| 877 | 902 | ||
| @@ -897,7 +922,7 @@ void kill_block_super(struct super_block *sb) | |||
| 897 | struct block_device *bdev = sb->s_bdev; | 922 | struct block_device *bdev = sb->s_bdev; |
| 898 | fmode_t mode = sb->s_mode; | 923 | fmode_t mode = sb->s_mode; |
| 899 | 924 | ||
| 900 | bdev->bd_super = 0; | 925 | bdev->bd_super = NULL; |
| 901 | generic_shutdown_super(sb); | 926 | generic_shutdown_super(sb); |
| 902 | sync_blockdev(bdev); | 927 | sync_blockdev(bdev); |
| 903 | close_bdev_exclusive(bdev, mode); | 928 | close_bdev_exclusive(bdev, mode); |
| @@ -921,8 +946,7 @@ int get_sb_nodev(struct file_system_type *fs_type, | |||
| 921 | 946 | ||
| 922 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 947 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
| 923 | if (error) { | 948 | if (error) { |
| 924 | up_write(&s->s_umount); | 949 | deactivate_locked_super(s); |
| 925 | deactivate_super(s); | ||
| 926 | return error; | 950 | return error; |
| 927 | } | 951 | } |
| 928 | s->s_flags |= MS_ACTIVE; | 952 | s->s_flags |= MS_ACTIVE; |
| @@ -952,8 +976,7 @@ int get_sb_single(struct file_system_type *fs_type, | |||
| 952 | s->s_flags = flags; | 976 | s->s_flags = flags; |
| 953 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 977 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
| 954 | if (error) { | 978 | if (error) { |
| 955 | up_write(&s->s_umount); | 979 | deactivate_locked_super(s); |
| 956 | deactivate_super(s); | ||
| 957 | return error; | 980 | return error; |
| 958 | } | 981 | } |
| 959 | s->s_flags |= MS_ACTIVE; | 982 | s->s_flags |= MS_ACTIVE; |
| @@ -1006,8 +1029,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
| 1006 | return mnt; | 1029 | return mnt; |
| 1007 | out_sb: | 1030 | out_sb: |
| 1008 | dput(mnt->mnt_root); | 1031 | dput(mnt->mnt_root); |
| 1009 | up_write(&mnt->mnt_sb->s_umount); | 1032 | deactivate_locked_super(mnt->mnt_sb); |
| 1010 | deactivate_super(mnt->mnt_sb); | ||
| 1011 | out_free_secdata: | 1033 | out_free_secdata: |
| 1012 | free_secdata(secdata); | 1034 | free_secdata(secdata); |
| 1013 | out_mnt: | 1035 | out_mnt: |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index faa44f90608a..e9f7a754c4f7 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -2055,8 +2055,7 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags, | |||
| 2055 | return 0; | 2055 | return 0; |
| 2056 | 2056 | ||
| 2057 | out_deact: | 2057 | out_deact: |
| 2058 | up_write(&sb->s_umount); | 2058 | deactivate_locked_super(sb); |
| 2059 | deactivate_super(sb); | ||
| 2060 | out_close: | 2059 | out_close: |
| 2061 | ubi_close_volume(ubi); | 2060 | ubi_close_volume(ubi); |
| 2062 | return err; | 2061 | return err; |
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index dbbbc4668769..6321b797061b 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
| @@ -666,6 +666,6 @@ not_empty: | |||
| 666 | const struct file_operations ufs_dir_operations = { | 666 | const struct file_operations ufs_dir_operations = { |
| 667 | .read = generic_read_dir, | 667 | .read = generic_read_dir, |
| 668 | .readdir = ufs_readdir, | 668 | .readdir = ufs_readdir, |
| 669 | .fsync = file_fsync, | 669 | .fsync = ufs_sync_file, |
| 670 | .llseek = generic_file_llseek, | 670 | .llseek = generic_file_llseek, |
| 671 | }; | 671 | }; |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 625ef17c6f83..2bd3a1615714 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include "ufs.h" | 30 | #include "ufs.h" |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) | 33 | int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) |
| 34 | { | 34 | { |
| 35 | struct inode *inode = dentry->d_inode; | 35 | struct inode *inode = dentry->d_inode; |
| 36 | int err; | 36 | int err; |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index 69b3427d7885..d0c4acd4f1f3 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
| @@ -98,8 +98,8 @@ extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, | |||
| 98 | /* file.c */ | 98 | /* file.c */ |
| 99 | extern const struct inode_operations ufs_file_inode_operations; | 99 | extern const struct inode_operations ufs_file_inode_operations; |
| 100 | extern const struct file_operations ufs_file_operations; | 100 | extern const struct file_operations ufs_file_operations; |
| 101 | |||
| 102 | extern const struct address_space_operations ufs_aops; | 101 | extern const struct address_space_operations ufs_aops; |
| 102 | extern int ufs_sync_file(struct file *, struct dentry *, int); | ||
| 103 | 103 | ||
| 104 | /* ialloc.c */ | 104 | /* ialloc.c */ |
| 105 | extern void ufs_free_inode (struct inode *inode); | 105 | extern void ufs_free_inode (struct inode *inode); |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index ca9b9b9bd331..3f0eaa397ef5 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -138,6 +138,7 @@ header-y += qnxtypes.h | |||
| 138 | header-y += radeonfb.h | 138 | header-y += radeonfb.h |
| 139 | header-y += raw.h | 139 | header-y += raw.h |
| 140 | header-y += resource.h | 140 | header-y += resource.h |
| 141 | header-y += romfs_fs.h | ||
| 141 | header-y += rose.h | 142 | header-y += rose.h |
| 142 | header-y += serial_reg.h | 143 | header-y += serial_reg.h |
| 143 | header-y += smbno.h | 144 | header-y += smbno.h |
| @@ -314,7 +315,6 @@ unifdef-y += irqnr.h | |||
| 314 | unifdef-y += reboot.h | 315 | unifdef-y += reboot.h |
| 315 | unifdef-y += reiserfs_fs.h | 316 | unifdef-y += reiserfs_fs.h |
| 316 | unifdef-y += reiserfs_xattr.h | 317 | unifdef-y += reiserfs_xattr.h |
| 317 | unifdef-y += romfs_fs.h | ||
| 318 | unifdef-y += route.h | 318 | unifdef-y += route.h |
| 319 | unifdef-y += rtc.h | 319 | unifdef-y += rtc.h |
| 320 | unifdef-y += rtnetlink.h | 320 | unifdef-y += rtnetlink.h |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5bed436f4353..3b534e527e09 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1775,6 +1775,7 @@ void kill_block_super(struct super_block *sb); | |||
| 1775 | void kill_anon_super(struct super_block *sb); | 1775 | void kill_anon_super(struct super_block *sb); |
| 1776 | void kill_litter_super(struct super_block *sb); | 1776 | void kill_litter_super(struct super_block *sb); |
| 1777 | void deactivate_super(struct super_block *sb); | 1777 | void deactivate_super(struct super_block *sb); |
| 1778 | void deactivate_locked_super(struct super_block *sb); | ||
| 1778 | int set_anon_super(struct super_block *s, void *data); | 1779 | int set_anon_super(struct super_block *s, void *data); |
| 1779 | struct super_block *sget(struct file_system_type *type, | 1780 | struct super_block *sget(struct file_system_type *type, |
| 1780 | int (*test)(struct super_block *,void *), | 1781 | int (*test)(struct super_block *,void *), |
| @@ -2117,7 +2118,7 @@ extern struct file *create_write_pipe(int flags); | |||
| 2117 | extern void free_write_pipe(struct file *); | 2118 | extern void free_write_pipe(struct file *); |
| 2118 | 2119 | ||
| 2119 | extern struct file *do_filp_open(int dfd, const char *pathname, | 2120 | extern struct file *do_filp_open(int dfd, const char *pathname, |
| 2120 | int open_flag, int mode); | 2121 | int open_flag, int mode, int acc_mode); |
| 2121 | extern int may_open(struct path *, int, int); | 2122 | extern int may_open(struct path *, int, int); |
| 2122 | 2123 | ||
| 2123 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 2124 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); |
| @@ -2367,6 +2368,7 @@ extern void file_update_time(struct file *file); | |||
| 2367 | 2368 | ||
| 2368 | extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); | 2369 | extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); |
| 2369 | extern void save_mount_options(struct super_block *sb, char *options); | 2370 | extern void save_mount_options(struct super_block *sb, char *options); |
| 2371 | extern void replace_mount_options(struct super_block *sb, char *options); | ||
| 2370 | 2372 | ||
| 2371 | static inline ino_t parent_ino(struct dentry *dentry) | 2373 | static inline ino_t parent_ino(struct dentry *dentry) |
| 2372 | { | 2374 | { |
diff --git a/include/linux/namei.h b/include/linux/namei.h index fc2e03579877..518098fe63af 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -69,7 +69,6 @@ extern int path_lookup(const char *, unsigned, struct nameidata *); | |||
| 69 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 69 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
| 70 | const char *, unsigned int, struct nameidata *); | 70 | const char *, unsigned int, struct nameidata *); |
| 71 | 71 | ||
| 72 | extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); | ||
| 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, | 72 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, |
| 74 | int (*open)(struct inode *, struct file *)); | 73 | int (*open)(struct inode *, struct file *)); |
| 75 | extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | 74 | extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 6b361d23a499..6473650c28f1 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
| @@ -402,7 +402,7 @@ struct reiserfs_sb_info { | |||
| 402 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | 402 | int reserved_blocks; /* amount of blocks reserved for further allocations */ |
| 403 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | 403 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ |
| 404 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | 404 | struct dentry *priv_root; /* root of /.reiserfs_priv */ |
| 405 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ | 405 | struct dentry *xattr_root; /* root of /.reiserfs_priv/xattrs */ |
| 406 | int j_errno; | 406 | int j_errno; |
| 407 | #ifdef CONFIG_QUOTA | 407 | #ifdef CONFIG_QUOTA |
| 408 | char *s_qf_names[MAXQUOTAS]; | 408 | char *s_qf_names[MAXQUOTAS]; |
| @@ -488,7 +488,6 @@ enum reiserfs_mount_options { | |||
| 488 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | 488 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) |
| 489 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | 489 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) |
| 490 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | 490 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) |
| 491 | #define reiserfs_xattrs(s) ((s)->s_xattr != NULL) | ||
| 492 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | 491 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) |
| 493 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | 492 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) |
| 494 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | 493 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index dcae01e63e40..cdedc01036e4 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
| @@ -38,6 +38,7 @@ struct nameidata; | |||
| 38 | int reiserfs_xattr_register_handlers(void) __init; | 38 | int reiserfs_xattr_register_handlers(void) __init; |
| 39 | void reiserfs_xattr_unregister_handlers(void); | 39 | void reiserfs_xattr_unregister_handlers(void); |
| 40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | 40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
| 41 | int reiserfs_lookup_privroot(struct super_block *sb); | ||
| 41 | int reiserfs_delete_xattrs(struct inode *inode); | 42 | int reiserfs_delete_xattrs(struct inode *inode); |
| 42 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | 43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); |
| 43 | 44 | ||
| @@ -97,7 +98,7 @@ static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | |||
| 97 | 98 | ||
| 98 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | 99 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { |
| 99 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 100 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
| 100 | if (REISERFS_SB(inode->i_sb)->xattr_root == NULL) | 101 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) |
| 101 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 102 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
| 102 | } | 103 | } |
| 103 | 104 | ||
diff --git a/include/linux/romfs_fs.h b/include/linux/romfs_fs.h index e20bbf9eb365..c490fbc43fe2 100644 --- a/include/linux/romfs_fs.h +++ b/include/linux/romfs_fs.h | |||
| @@ -53,9 +53,4 @@ struct romfs_inode { | |||
| 53 | #define ROMFH_PAD (ROMFH_SIZE-1) | 53 | #define ROMFH_PAD (ROMFH_SIZE-1) |
| 54 | #define ROMFH_MASK (~ROMFH_PAD) | 54 | #define ROMFH_MASK (~ROMFH_PAD) |
| 55 | 55 | ||
| 56 | #ifdef __KERNEL__ | ||
| 57 | |||
| 58 | /* Not much now */ | ||
| 59 | |||
| 60 | #endif /* __KERNEL__ */ | ||
| 61 | #endif | 56 | #endif |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 382109b5baeb..a7267bfd3765 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -1133,8 +1133,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, | |||
| 1133 | free_cg_links: | 1133 | free_cg_links: |
| 1134 | free_cg_links(&tmp_cg_links); | 1134 | free_cg_links(&tmp_cg_links); |
| 1135 | drop_new_super: | 1135 | drop_new_super: |
| 1136 | up_write(&sb->s_umount); | 1136 | deactivate_locked_super(sb); |
| 1137 | deactivate_super(sb); | ||
| 1138 | return ret; | 1137 | return ret; |
| 1139 | } | 1138 | } |
| 1140 | 1139 | ||
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index d4d41b3efc7c..ddfb9cccf468 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
| @@ -1720,14 +1720,14 @@ static bool tomoyo_policy_loader_exists(void) | |||
| 1720 | * policies are not loaded yet. | 1720 | * policies are not loaded yet. |
| 1721 | * Thus, let do_execve() call this function everytime. | 1721 | * Thus, let do_execve() call this function everytime. |
| 1722 | */ | 1722 | */ |
| 1723 | struct nameidata nd; | 1723 | struct path path; |
| 1724 | 1724 | ||
| 1725 | if (path_lookup(tomoyo_loader, LOOKUP_FOLLOW, &nd)) { | 1725 | if (kern_path(tomoyo_loader, LOOKUP_FOLLOW, &path)) { |
| 1726 | printk(KERN_INFO "Not activating Mandatory Access Control now " | 1726 | printk(KERN_INFO "Not activating Mandatory Access Control now " |
| 1727 | "since %s doesn't exist.\n", tomoyo_loader); | 1727 | "since %s doesn't exist.\n", tomoyo_loader); |
| 1728 | return false; | 1728 | return false; |
| 1729 | } | 1729 | } |
| 1730 | path_put(&nd.path); | 1730 | path_put(&path); |
| 1731 | return true; | 1731 | return true; |
| 1732 | } | 1732 | } |
| 1733 | 1733 | ||
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index bf8e2b451687..40927a84cb6e 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
| @@ -165,11 +165,11 @@ char *tomoyo_realpath_from_path(struct path *path) | |||
| 165 | */ | 165 | */ |
| 166 | char *tomoyo_realpath(const char *pathname) | 166 | char *tomoyo_realpath(const char *pathname) |
| 167 | { | 167 | { |
| 168 | struct nameidata nd; | 168 | struct path path; |
| 169 | 169 | ||
| 170 | if (pathname && path_lookup(pathname, LOOKUP_FOLLOW, &nd) == 0) { | 170 | if (pathname && kern_path(pathname, LOOKUP_FOLLOW, &path) == 0) { |
| 171 | char *buf = tomoyo_realpath_from_path(&nd.path); | 171 | char *buf = tomoyo_realpath_from_path(&path); |
| 172 | path_put(&nd.path); | 172 | path_put(&path); |
| 173 | return buf; | 173 | return buf; |
| 174 | } | 174 | } |
| 175 | return NULL; | 175 | return NULL; |
| @@ -184,11 +184,11 @@ char *tomoyo_realpath(const char *pathname) | |||
| 184 | */ | 184 | */ |
| 185 | char *tomoyo_realpath_nofollow(const char *pathname) | 185 | char *tomoyo_realpath_nofollow(const char *pathname) |
| 186 | { | 186 | { |
| 187 | struct nameidata nd; | 187 | struct path path; |
| 188 | 188 | ||
| 189 | if (pathname && path_lookup(pathname, 0, &nd) == 0) { | 189 | if (pathname && kern_path(pathname, 0, &path) == 0) { |
| 190 | char *buf = tomoyo_realpath_from_path(&nd.path); | 190 | char *buf = tomoyo_realpath_from_path(&path); |
| 191 | path_put(&nd.path); | 191 | path_put(&path); |
| 192 | return buf; | 192 | return buf; |
| 193 | } | 193 | } |
| 194 | return NULL; | 194 | return NULL; |
