vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 7 Dec 2011 23:16:57 +0000 (18:16 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 7 Jan 2012 04:16:53 +0000 (23:16 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 files changed:
fs/autofs4/dev-ioctl.c
fs/binfmt_misc.c
fs/ext3/super.c
fs/ext4/super.c
fs/fhandle.c
fs/lockd/svcsubs.c
fs/nfsd/nfsctl.c
fs/quota/dquot.c
fs/reiserfs/super.c
fs/sysv/itree.c
init/do_mounts.c
kernel/acct.c
security/selinux/hooks.c
security/smack/smack_lsm.c

index 509fe1eb66ae31babcceda94ab8fd0a04268ebcb..76741d8d77866496496115312f6831b85cc51570 100644 (file)
@@ -194,7 +194,7 @@ static int find_autofs_mount(const char *pathname,
                return err;
        err = -ENOENT;
        while (path.dentry == path.mnt->mnt_root) {
-               if (path.mnt->mnt_sb->s_magic == AUTOFS_SUPER_MAGIC) {
+               if (path.dentry->d_sb->s_magic == AUTOFS_SUPER_MAGIC) {
                        if (test(&path, data)) {
                                path_get(&path);
                                if (!err) /* already found some */
@@ -212,7 +212,7 @@ static int find_autofs_mount(const char *pathname,
 
 static int test_by_dev(struct path *path, void *p)
 {
-       return path->mnt->mnt_sb->s_dev == *(dev_t *)p;
+       return path->dentry->d_sb->s_dev == *(dev_t *)p;
 }
 
 static int test_by_type(struct path *path, void *p)
@@ -538,11 +538,11 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
                        err = find_autofs_mount(name, &path, test_by_type, &type);
                if (err)
                        goto out;
-               devid = new_encode_dev(path.mnt->mnt_sb->s_dev);
+               devid = new_encode_dev(path.dentry->d_sb->s_dev);
                err = 0;
                if (path.mnt->mnt_root == path.dentry) {
                        err = 1;
-                       magic = path.mnt->mnt_sb->s_magic;
+                       magic = path.dentry->d_sb->s_magic;
                }
        } else {
                dev_t dev = sbi->sb->s_dev;
@@ -556,7 +556,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
                err = have_submounts(path.dentry);
 
                if (follow_down_one(&path))
-                       magic = path.mnt->mnt_sb->s_magic;
+                       magic = path.dentry->d_sb->s_magic;
        }
 
        param->ismountpoint.out.devid = devid;
index 1e9edbdeda7ebcbe243b299d46859c4917f0e217..a9198dfd5f8509064c24112b875e61743bb60e51 100644 (file)
@@ -560,7 +560,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
                        break;
                case 2: set_bit(Enabled, &e->flags);
                        break;
-               case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
+               case 3: root = dget(file->f_path.dentry->d_sb->s_root);
                        mutex_lock(&root->d_inode->i_mutex);
 
                        kill_node(e);
@@ -587,7 +587,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
        Node *e;
        struct inode *inode;
        struct dentry *root, *dentry;
-       struct super_block *sb = file->f_path.mnt->mnt_sb;
+       struct super_block *sb = file->f_path.dentry->d_sb;
        int err = 0;
 
        e = create_entry(buffer, count);
@@ -666,7 +666,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
        switch (res) {
                case 1: enabled = 0; break;
                case 2: enabled = 1; break;
-               case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
+               case 3: root = dget(file->f_path.dentry->d_sb->s_root);
                        mutex_lock(&root->d_inode->i_mutex);
 
                        while (!list_empty(&entries))
index 668c931b22140489d30c1fc350c8610cde1bd7ac..7e8944ee67c65ca035f16968fee2cdbb5e8039cc 100644 (file)
@@ -2909,7 +2909,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
                return -EINVAL;
 
        /* Quotafile not on the same filesystem? */
-       if (path->mnt->mnt_sb != sb)
+       if (path->dentry->d_sb != sb)
                return -EXDEV;
        /* Journaling quota? */
        if (EXT3_SB(sb)->s_qf_names[type]) {
index 2a1a9e63cffad0e2f3e3f30d122d7e5b52fcd185..b739b210a6161446437398ce7d38fd5d1018cddf 100644 (file)
@@ -4781,7 +4781,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                return -EINVAL;
 
        /* Quotafile not on the same filesystem? */
-       if (path->mnt->mnt_sb != sb)
+       if (path->dentry->d_sb != sb)
                return -EXDEV;
        /* Journaling quota? */
        if (EXT4_SB(sb)->s_qf_names[type]) {
index 5eff7116951e928c588d0cc5b3d68326f15aaa27..a48e4a139be150d01aed47a4e387a14db9e731cb 100644 (file)
@@ -25,8 +25,8 @@ static long do_sys_name_to_handle(struct path *path,
         * We need t make sure wether the file system
         * support decoding of the file handle
         */
-       if (!path->mnt->mnt_sb->s_export_op ||
-           !path->mnt->mnt_sb->s_export_op->fh_to_dentry)
+       if (!path->dentry->d_sb->s_export_op ||
+           !path->dentry->d_sb->s_export_op->fh_to_dentry)
                return -EOPNOTSUPP;
 
        if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle)))
index 1ca0679c80bfcca842d277f7597d96dbe8792c35..2240d384d7877042c44ba134489b431e9de10118 100644 (file)
@@ -403,7 +403,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file)
 {
        struct super_block *sb = datap;
 
-       return sb == file->f_file->f_path.mnt->mnt_sb;
+       return sb == file->f_file->f_path.dentry->d_sb;
 }
 
 /**
index c45a2ea4a09097acba065bbd7cdfaf1718cb7d23..bb4a11d58a5aac3e6f1e8121ab94e2121c9a3290 100644 (file)
@@ -272,7 +272,7 @@ static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size)
         * 2.  Is that directory a mount point, or
         * 3.  Is that directory the root of an exported file system?
         */
-       error = nlmsvc_unlock_all_by_sb(path.mnt->mnt_sb);
+       error = nlmsvc_unlock_all_by_sb(path.dentry->d_sb);
 
        path_put(&path);
        return error;
index 5d81e92daf837e66d4a8862e1c06ff012ec8d827..5ec59b20cf761732f57e5eb76231579ab7c03b97 100644 (file)
@@ -2198,7 +2198,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id,
        if (error)
                return error;
        /* Quota file not on the same filesystem? */
-       if (path->mnt->mnt_sb != sb)
+       if (path->dentry->d_sb != sb)
                error = -EXDEV;
        else
                error = vfs_load_quota_inode(path->dentry->d_inode, type,
index 5a4cae7efc43f79b6bf1e446f70f5148e7f8782e..1abffa4515298fe2f493baabf5fe29c85fcbd0d5 100644 (file)
@@ -2058,7 +2058,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                return -EINVAL;
 
        /* Quotafile not on the same filesystem? */
-       if (path->mnt->mnt_sb != sb) {
+       if (path->dentry->d_sb != sb) {
                err = -EXDEV;
                goto out;
        }
index fa8d43c92bb81a7a03d3eda50f35dccec42bd44b..90b54b438789664b555931f07b42e1d356396e07 100644 (file)
@@ -442,7 +442,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
 
 int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 {
-       struct super_block *s = mnt->mnt_sb;
+       struct super_block *s = dentry->d_sb;
        generic_fillattr(dentry->d_inode, stat);
        stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size);
        stat->blksize = s->s_blocksize;
index 0f6e1d985a3b2851c662337c1671b57cc4270f0a..b2eee02e0f83fd720f38cf83a2b5e58ea27997b1 100644 (file)
@@ -325,17 +325,19 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
+       struct super_block *s;
        int err = sys_mount(name, "/root", fs, flags, data);
        if (err)
                return err;
 
        sys_chdir((const char __user __force *)"/root");
-       ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;
+       s = current->fs->pwd.dentry->d_sb;
+       ROOT_DEV = s->s_dev;
        printk(KERN_INFO
               "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
-              current->fs->pwd.mnt->mnt_sb->s_type->name,
-              current->fs->pwd.mnt->mnt_sb->s_flags & MS_RDONLY ?
-              " readonly" : "", MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
+              s->s_type->name,
+              s->s_flags & MS_RDONLY ?  " readonly" : "",
+              MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
        return 0;
 }
 
index 8cba12429d824ae14f1448757edafa0e5a4c61b9..9663eb8058f95c8a41d2faaa888240ec938d74ff 100644 (file)
@@ -315,7 +315,7 @@ void acct_auto_close(struct super_block *sb)
        spin_lock(&acct_lock);
 restart:
        list_for_each_entry(acct, &acct_list, list)
-               if (acct->file && acct->file->f_path.mnt->mnt_sb == sb) {
+               if (acct->file && acct->file->f_path.dentry->d_sb == sb) {
                        acct_file_reopen(acct, NULL, NULL);
                        goto restart;
                }
index 4def4d92aaeeb5bc48b4ac8b5338aa9dcbb33996..57546cfb18ec19931140b4727e494385684feb2d 100644 (file)
@@ -2507,7 +2507,7 @@ static int selinux_mount(char *dev_name,
        const struct cred *cred = current_cred();
 
        if (flags & MS_REMOUNT)
-               return superblock_has_perm(cred, path->mnt->mnt_sb,
+               return superblock_has_perm(cred, path->dentry->d_sb,
                                           FILESYSTEM__REMOUNT, NULL);
        else
                return path_has_perm(cred, path, FILE__MOUNTON);
index 7db62b48eb4241d2ec15b18edc934faae67faa83..e8af5b0ba80f840ba277c789736d5ca3766cc30d 100644 (file)
@@ -406,7 +406,7 @@ static int smack_sb_statfs(struct dentry *dentry)
 static int smack_sb_mount(char *dev_name, struct path *path,
                          char *type, unsigned long flags, void *data)
 {
-       struct superblock_smack *sbp = path->mnt->mnt_sb->s_security;
+       struct superblock_smack *sbp = path->dentry->d_sb->s_security;
        struct smk_audit_info ad;
 
        smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
@@ -435,7 +435,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags)
        smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
        smk_ad_setfield_u_fs_path(&ad, path);
 
-       sbp = mnt->mnt_sb->s_security;
+       sbp = path.dentry->d_sb->s_security;
        return smk_curacc(sbp->smk_floor, MAY_WRITE, &ad);
 }