Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro d8c9584e ece2ccb6

+27 -25
+5 -5
fs/autofs4/dev-ioctl.c
··· 194 194 return err; 195 195 err = -ENOENT; 196 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 198 if (test(&path, data)) { 199 199 path_get(&path); 200 200 if (!err) /* already found some */ ··· 212 212 213 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 218 static int test_by_type(struct path *path, void *p) ··· 538 538 err = find_autofs_mount(name, &path, test_by_type, &type); 539 539 if (err) 540 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 542 err = 0; 543 543 if (path.mnt->mnt_root == path.dentry) { 544 544 err = 1; 545 - magic = path.mnt->mnt_sb->s_magic; 545 + magic = path.dentry->d_sb->s_magic; 546 546 } 547 547 } else { 548 548 dev_t dev = sbi->sb->s_dev; ··· 556 556 err = have_submounts(path.dentry); 557 557 558 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 562 param->ismountpoint.out.devid = devid;
+3 -3
fs/binfmt_misc.c
··· 560 560 break; 561 561 case 2: set_bit(Enabled, &e->flags); 562 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 564 mutex_lock(&root->d_inode->i_mutex); 565 565 566 566 kill_node(e); ··· 587 587 Node *e; 588 588 struct inode *inode; 589 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 591 int err = 0; 592 592 593 593 e = create_entry(buffer, count); ··· 666 666 switch (res) { 667 667 case 1: enabled = 0; break; 668 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 670 mutex_lock(&root->d_inode->i_mutex); 671 671 672 672 while (!list_empty(&entries))
+1 -1
fs/ext3/super.c
··· 2909 2909 return -EINVAL; 2910 2910 2911 2911 /* Quotafile not on the same filesystem? */ 2912 - if (path->mnt->mnt_sb != sb) 2912 + if (path->dentry->d_sb != sb) 2913 2913 return -EXDEV; 2914 2914 /* Journaling quota? */ 2915 2915 if (EXT3_SB(sb)->s_qf_names[type]) {
+1 -1
fs/ext4/super.c
··· 4781 4781 return -EINVAL; 4782 4782 4783 4783 /* Quotafile not on the same filesystem? */ 4784 - if (path->mnt->mnt_sb != sb) 4784 + if (path->dentry->d_sb != sb) 4785 4785 return -EXDEV; 4786 4786 /* Journaling quota? */ 4787 4787 if (EXT4_SB(sb)->s_qf_names[type]) {
+2 -2
fs/fhandle.c
··· 25 25 * We need t make sure wether the file system 26 26 * support decoding of the file handle 27 27 */ 28 - if (!path->mnt->mnt_sb->s_export_op || 29 - !path->mnt->mnt_sb->s_export_op->fh_to_dentry) 28 + if (!path->dentry->d_sb->s_export_op || 29 + !path->dentry->d_sb->s_export_op->fh_to_dentry) 30 30 return -EOPNOTSUPP; 31 31 32 32 if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle)))
+1 -1
fs/lockd/svcsubs.c
··· 403 403 { 404 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 /**
+1 -1
fs/nfsd/nfsctl.c
··· 272 272 * 2. Is that directory a mount point, or 273 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 277 path_put(&path); 278 278 return error;
+1 -1
fs/quota/dquot.c
··· 2198 2198 if (error) 2199 2199 return error; 2200 2200 /* Quota file not on the same filesystem? */ 2201 - if (path->mnt->mnt_sb != sb) 2201 + if (path->dentry->d_sb != sb) 2202 2202 error = -EXDEV; 2203 2203 else 2204 2204 error = vfs_load_quota_inode(path->dentry->d_inode, type,
+1 -1
fs/reiserfs/super.c
··· 2058 2058 return -EINVAL; 2059 2059 2060 2060 /* Quotafile not on the same filesystem? */ 2061 - if (path->mnt->mnt_sb != sb) { 2061 + if (path->dentry->d_sb != sb) { 2062 2062 err = -EXDEV; 2063 2063 goto out; 2064 2064 }
+1 -1
fs/sysv/itree.c
··· 442 442 443 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 446 generic_fillattr(dentry->d_inode, stat); 447 447 stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); 448 448 stat->blksize = s->s_blocksize;
+6 -4
init/do_mounts.c
··· 325 325 326 326 static int __init do_mount_root(char *name, char *fs, int flags, void *data) 327 327 { 328 + struct super_block *s; 328 329 int err = sys_mount(name, "/root", fs, flags, data); 329 330 if (err) 330 331 return err; 331 332 332 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 336 printk(KERN_INFO 335 337 "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", 336 - current->fs->pwd.mnt->mnt_sb->s_type->name, 337 - current->fs->pwd.mnt->mnt_sb->s_flags & MS_RDONLY ? 338 - " readonly" : "", MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); 338 + s->s_type->name, 339 + s->s_flags & MS_RDONLY ? " readonly" : "", 340 + MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); 339 341 return 0; 340 342 } 341 343
+1 -1
kernel/acct.c
··· 315 315 spin_lock(&acct_lock); 316 316 restart: 317 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 319 acct_file_reopen(acct, NULL, NULL); 320 320 goto restart; 321 321 }
+1 -1
security/selinux/hooks.c
··· 2507 2507 const struct cred *cred = current_cred(); 2508 2508 2509 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 2511 FILESYSTEM__REMOUNT, NULL); 2512 2512 else 2513 2513 return path_has_perm(cred, path, FILE__MOUNTON);
+2 -2
security/smack/smack_lsm.c
··· 406 406 static int smack_sb_mount(char *dev_name, struct path *path, 407 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 410 struct smk_audit_info ad; 411 411 412 412 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); ··· 435 435 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); 436 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 439 return smk_curacc(sbp->smk_floor, MAY_WRITE, &ad); 440 440 } 441 441