diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-12-07 18:16:57 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-06 23:16:53 -0500 |
commit | d8c9584ea2a92879f471fd3a2be3af6c534fb035 (patch) | |
tree | 3541b9c6228f820bdc65e4875156eb27b1c91cb1 | |
parent | ece2ccb668046610189d88d6aaf05aeb09c988a1 (diff) |
vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/autofs4/dev-ioctl.c | 10 | ||||
-rw-r--r-- | fs/binfmt_misc.c | 6 | ||||
-rw-r--r-- | fs/ext3/super.c | 2 | ||||
-rw-r--r-- | fs/ext4/super.c | 2 | ||||
-rw-r--r-- | fs/fhandle.c | 4 | ||||
-rw-r--r-- | fs/lockd/svcsubs.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 2 | ||||
-rw-r--r-- | fs/quota/dquot.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 | ||||
-rw-r--r-- | fs/sysv/itree.c | 2 | ||||
-rw-r--r-- | init/do_mounts.c | 10 | ||||
-rw-r--r-- | kernel/acct.c | 2 | ||||
-rw-r--r-- | security/selinux/hooks.c | 2 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 4 |
14 files changed, 27 insertions, 25 deletions
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index 509fe1eb66ae..76741d8d7786 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -194,7 +194,7 @@ static int find_autofs_mount(const char *pathname, | |||
194 | return err; | 194 | return err; |
195 | err = -ENOENT; | 195 | err = -ENOENT; |
196 | while (path.dentry == path.mnt->mnt_root) { | 196 | while (path.dentry == path.mnt->mnt_root) { |
197 | if (path.mnt->mnt_sb->s_magic == AUTOFS_SUPER_MAGIC) { | 197 | if (path.dentry->d_sb->s_magic == AUTOFS_SUPER_MAGIC) { |
198 | if (test(&path, data)) { | 198 | if (test(&path, data)) { |
199 | path_get(&path); | 199 | path_get(&path); |
200 | if (!err) /* already found some */ | 200 | if (!err) /* already found some */ |
@@ -212,7 +212,7 @@ static int find_autofs_mount(const char *pathname, | |||
212 | 212 | ||
213 | static int test_by_dev(struct path *path, void *p) | 213 | static int test_by_dev(struct path *path, void *p) |
214 | { | 214 | { |
215 | return path->mnt->mnt_sb->s_dev == *(dev_t *)p; | 215 | return path->dentry->d_sb->s_dev == *(dev_t *)p; |
216 | } | 216 | } |
217 | 217 | ||
218 | static int test_by_type(struct path *path, void *p) | 218 | static int test_by_type(struct path *path, void *p) |
@@ -538,11 +538,11 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp, | |||
538 | err = find_autofs_mount(name, &path, test_by_type, &type); | 538 | err = find_autofs_mount(name, &path, test_by_type, &type); |
539 | if (err) | 539 | if (err) |
540 | goto out; | 540 | goto out; |
541 | devid = new_encode_dev(path.mnt->mnt_sb->s_dev); | 541 | devid = new_encode_dev(path.dentry->d_sb->s_dev); |
542 | err = 0; | 542 | err = 0; |
543 | if (path.mnt->mnt_root == path.dentry) { | 543 | if (path.mnt->mnt_root == path.dentry) { |
544 | err = 1; | 544 | err = 1; |
545 | magic = path.mnt->mnt_sb->s_magic; | 545 | magic = path.dentry->d_sb->s_magic; |
546 | } | 546 | } |
547 | } else { | 547 | } else { |
548 | dev_t dev = sbi->sb->s_dev; | 548 | dev_t dev = sbi->sb->s_dev; |
@@ -556,7 +556,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp, | |||
556 | err = have_submounts(path.dentry); | 556 | err = have_submounts(path.dentry); |
557 | 557 | ||
558 | if (follow_down_one(&path)) | 558 | if (follow_down_one(&path)) |
559 | magic = path.mnt->mnt_sb->s_magic; | 559 | magic = path.dentry->d_sb->s_magic; |
560 | } | 560 | } |
561 | 561 | ||
562 | param->ismountpoint.out.devid = devid; | 562 | param->ismountpoint.out.devid = devid; |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 1e9edbdeda7e..a9198dfd5f85 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -560,7 +560,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, | |||
560 | break; | 560 | break; |
561 | case 2: set_bit(Enabled, &e->flags); | 561 | case 2: set_bit(Enabled, &e->flags); |
562 | break; | 562 | break; |
563 | case 3: root = dget(file->f_path.mnt->mnt_sb->s_root); | 563 | case 3: root = dget(file->f_path.dentry->d_sb->s_root); |
564 | mutex_lock(&root->d_inode->i_mutex); | 564 | mutex_lock(&root->d_inode->i_mutex); |
565 | 565 | ||
566 | kill_node(e); | 566 | kill_node(e); |
@@ -587,7 +587,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
587 | Node *e; | 587 | Node *e; |
588 | struct inode *inode; | 588 | struct inode *inode; |
589 | struct dentry *root, *dentry; | 589 | struct dentry *root, *dentry; |
590 | struct super_block *sb = file->f_path.mnt->mnt_sb; | 590 | struct super_block *sb = file->f_path.dentry->d_sb; |
591 | int err = 0; | 591 | int err = 0; |
592 | 592 | ||
593 | e = create_entry(buffer, count); | 593 | e = create_entry(buffer, count); |
@@ -666,7 +666,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer, | |||
666 | switch (res) { | 666 | switch (res) { |
667 | case 1: enabled = 0; break; | 667 | case 1: enabled = 0; break; |
668 | case 2: enabled = 1; break; | 668 | case 2: enabled = 1; break; |
669 | case 3: root = dget(file->f_path.mnt->mnt_sb->s_root); | 669 | case 3: root = dget(file->f_path.dentry->d_sb->s_root); |
670 | mutex_lock(&root->d_inode->i_mutex); | 670 | mutex_lock(&root->d_inode->i_mutex); |
671 | 671 | ||
672 | while (!list_empty(&entries)) | 672 | while (!list_empty(&entries)) |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 668c931b2214..7e8944ee67c6 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -2909,7 +2909,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
2909 | return -EINVAL; | 2909 | return -EINVAL; |
2910 | 2910 | ||
2911 | /* Quotafile not on the same filesystem? */ | 2911 | /* Quotafile not on the same filesystem? */ |
2912 | if (path->mnt->mnt_sb != sb) | 2912 | if (path->dentry->d_sb != sb) |
2913 | return -EXDEV; | 2913 | return -EXDEV; |
2914 | /* Journaling quota? */ | 2914 | /* Journaling quota? */ |
2915 | if (EXT3_SB(sb)->s_qf_names[type]) { | 2915 | if (EXT3_SB(sb)->s_qf_names[type]) { |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 2a1a9e63cffa..b739b210a616 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -4781,7 +4781,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
4781 | return -EINVAL; | 4781 | return -EINVAL; |
4782 | 4782 | ||
4783 | /* Quotafile not on the same filesystem? */ | 4783 | /* Quotafile not on the same filesystem? */ |
4784 | if (path->mnt->mnt_sb != sb) | 4784 | if (path->dentry->d_sb != sb) |
4785 | return -EXDEV; | 4785 | return -EXDEV; |
4786 | /* Journaling quota? */ | 4786 | /* Journaling quota? */ |
4787 | if (EXT4_SB(sb)->s_qf_names[type]) { | 4787 | if (EXT4_SB(sb)->s_qf_names[type]) { |
diff --git a/fs/fhandle.c b/fs/fhandle.c index 5eff7116951e..a48e4a139be1 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c | |||
@@ -25,8 +25,8 @@ static long do_sys_name_to_handle(struct path *path, | |||
25 | * We need t make sure wether the file system | 25 | * We need t make sure wether the file system |
26 | * support decoding of the file handle | 26 | * support decoding of the file handle |
27 | */ | 27 | */ |
28 | if (!path->mnt->mnt_sb->s_export_op || | 28 | if (!path->dentry->d_sb->s_export_op || |
29 | !path->mnt->mnt_sb->s_export_op->fh_to_dentry) | 29 | !path->dentry->d_sb->s_export_op->fh_to_dentry) |
30 | return -EOPNOTSUPP; | 30 | return -EOPNOTSUPP; |
31 | 31 | ||
32 | if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle))) | 32 | if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle))) |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 1ca0679c80bf..2240d384d787 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -403,7 +403,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file) | |||
403 | { | 403 | { |
404 | struct super_block *sb = datap; | 404 | struct super_block *sb = datap; |
405 | 405 | ||
406 | return sb == file->f_file->f_path.mnt->mnt_sb; | 406 | return sb == file->f_file->f_path.dentry->d_sb; |
407 | } | 407 | } |
408 | 408 | ||
409 | /** | 409 | /** |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index c45a2ea4a090..bb4a11d58a5a 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -272,7 +272,7 @@ static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size) | |||
272 | * 2. Is that directory a mount point, or | 272 | * 2. Is that directory a mount point, or |
273 | * 3. Is that directory the root of an exported file system? | 273 | * 3. Is that directory the root of an exported file system? |
274 | */ | 274 | */ |
275 | error = nlmsvc_unlock_all_by_sb(path.mnt->mnt_sb); | 275 | error = nlmsvc_unlock_all_by_sb(path.dentry->d_sb); |
276 | 276 | ||
277 | path_put(&path); | 277 | path_put(&path); |
278 | return error; | 278 | return error; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 5d81e92daf83..5ec59b20cf76 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -2198,7 +2198,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id, | |||
2198 | if (error) | 2198 | if (error) |
2199 | return error; | 2199 | return error; |
2200 | /* Quota file not on the same filesystem? */ | 2200 | /* Quota file not on the same filesystem? */ |
2201 | if (path->mnt->mnt_sb != sb) | 2201 | if (path->dentry->d_sb != sb) |
2202 | error = -EXDEV; | 2202 | error = -EXDEV; |
2203 | else | 2203 | else |
2204 | error = vfs_load_quota_inode(path->dentry->d_inode, type, | 2204 | error = vfs_load_quota_inode(path->dentry->d_inode, type, |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 5a4cae7efc43..1abffa451529 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -2058,7 +2058,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2058 | return -EINVAL; | 2058 | return -EINVAL; |
2059 | 2059 | ||
2060 | /* Quotafile not on the same filesystem? */ | 2060 | /* Quotafile not on the same filesystem? */ |
2061 | if (path->mnt->mnt_sb != sb) { | 2061 | if (path->dentry->d_sb != sb) { |
2062 | err = -EXDEV; | 2062 | err = -EXDEV; |
2063 | goto out; | 2063 | goto out; |
2064 | } | 2064 | } |
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index fa8d43c92bb8..90b54b438789 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c | |||
@@ -442,7 +442,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size) | |||
442 | 442 | ||
443 | int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 443 | int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
444 | { | 444 | { |
445 | struct super_block *s = mnt->mnt_sb; | 445 | struct super_block *s = dentry->d_sb; |
446 | generic_fillattr(dentry->d_inode, stat); | 446 | generic_fillattr(dentry->d_inode, stat); |
447 | stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); | 447 | stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); |
448 | stat->blksize = s->s_blocksize; | 448 | stat->blksize = s->s_blocksize; |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 0f6e1d985a3b..b2eee02e0f83 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -325,17 +325,19 @@ static void __init get_fs_names(char *page) | |||
325 | 325 | ||
326 | static int __init do_mount_root(char *name, char *fs, int flags, void *data) | 326 | static int __init do_mount_root(char *name, char *fs, int flags, void *data) |
327 | { | 327 | { |
328 | struct super_block *s; | ||
328 | int err = sys_mount(name, "/root", fs, flags, data); | 329 | int err = sys_mount(name, "/root", fs, flags, data); |
329 | if (err) | 330 | if (err) |
330 | return err; | 331 | return err; |
331 | 332 | ||
332 | sys_chdir((const char __user __force *)"/root"); | 333 | sys_chdir((const char __user __force *)"/root"); |
333 | ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev; | 334 | s = current->fs->pwd.dentry->d_sb; |
335 | ROOT_DEV = s->s_dev; | ||
334 | printk(KERN_INFO | 336 | printk(KERN_INFO |
335 | "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", | 337 | "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", |
336 | current->fs->pwd.mnt->mnt_sb->s_type->name, | 338 | s->s_type->name, |
337 | current->fs->pwd.mnt->mnt_sb->s_flags & MS_RDONLY ? | 339 | s->s_flags & MS_RDONLY ? " readonly" : "", |
338 | " readonly" : "", MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); | 340 | MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); |
339 | return 0; | 341 | return 0; |
340 | } | 342 | } |
341 | 343 | ||
diff --git a/kernel/acct.c b/kernel/acct.c index 8cba12429d82..9663eb8058f9 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -315,7 +315,7 @@ void acct_auto_close(struct super_block *sb) | |||
315 | spin_lock(&acct_lock); | 315 | spin_lock(&acct_lock); |
316 | restart: | 316 | restart: |
317 | list_for_each_entry(acct, &acct_list, list) | 317 | list_for_each_entry(acct, &acct_list, list) |
318 | if (acct->file && acct->file->f_path.mnt->mnt_sb == sb) { | 318 | if (acct->file && acct->file->f_path.dentry->d_sb == sb) { |
319 | acct_file_reopen(acct, NULL, NULL); | 319 | acct_file_reopen(acct, NULL, NULL); |
320 | goto restart; | 320 | goto restart; |
321 | } | 321 | } |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4def4d92aaee..57546cfb18ec 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2507,7 +2507,7 @@ static int selinux_mount(char *dev_name, | |||
2507 | const struct cred *cred = current_cred(); | 2507 | const struct cred *cred = current_cred(); |
2508 | 2508 | ||
2509 | if (flags & MS_REMOUNT) | 2509 | if (flags & MS_REMOUNT) |
2510 | return superblock_has_perm(cred, path->mnt->mnt_sb, | 2510 | return superblock_has_perm(cred, path->dentry->d_sb, |
2511 | FILESYSTEM__REMOUNT, NULL); | 2511 | FILESYSTEM__REMOUNT, NULL); |
2512 | else | 2512 | else |
2513 | return path_has_perm(cred, path, FILE__MOUNTON); | 2513 | return path_has_perm(cred, path, FILE__MOUNTON); |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 7db62b48eb42..e8af5b0ba80f 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -406,7 +406,7 @@ static int smack_sb_statfs(struct dentry *dentry) | |||
406 | static int smack_sb_mount(char *dev_name, struct path *path, | 406 | static int smack_sb_mount(char *dev_name, struct path *path, |
407 | char *type, unsigned long flags, void *data) | 407 | char *type, unsigned long flags, void *data) |
408 | { | 408 | { |
409 | struct superblock_smack *sbp = path->mnt->mnt_sb->s_security; | 409 | struct superblock_smack *sbp = path->dentry->d_sb->s_security; |
410 | struct smk_audit_info ad; | 410 | struct smk_audit_info ad; |
411 | 411 | ||
412 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); | 412 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); |
@@ -435,7 +435,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags) | |||
435 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); | 435 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); |
436 | smk_ad_setfield_u_fs_path(&ad, path); | 436 | smk_ad_setfield_u_fs_path(&ad, path); |
437 | 437 | ||
438 | sbp = mnt->mnt_sb->s_security; | 438 | sbp = path.dentry->d_sb->s_security; |
439 | return smk_curacc(sbp->smk_floor, MAY_WRITE, &ad); | 439 | return smk_curacc(sbp->smk_floor, MAY_WRITE, &ad); |
440 | } | 440 | } |
441 | 441 | ||