]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/autofs4/root.c
autofs4: pass mode to autofs4_get_inode() explicitly
[linux-beck.git] / fs / autofs4 / root.c
index dbd95512808c65805f2404032bf53e1b4ede5456..e55dcdbeb45091d19b0846005495679919d29722 100644 (file)
@@ -66,13 +66,7 @@ const struct inode_operations autofs4_dir_inode_operations = {
        .rmdir          = autofs4_dir_rmdir,
 };
 
-/* For dentries that don't initiate mounting */
 const struct dentry_operations autofs4_dentry_operations = {
-       .d_release      = autofs4_dentry_release,
-};
-
-/* For dentries that do initiate mounting */
-const struct dentry_operations autofs4_mount_dentry_operations = {
        .d_automount    = autofs4_d_automount,
        .d_manage       = autofs4_d_manage,
        .d_release      = autofs4_dentry_release,
@@ -494,14 +488,13 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
        sbi = autofs4_sbi(dir->i_sb);
 
        DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
-               current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode);
+               current->pid, task_pgrp_nr(current), sbi->catatonic,
+               autofs4_oz_mode(sbi));
 
        active = autofs4_lookup_active(dentry);
        if (active) {
                return active;
        } else {
-               d_set_d_op(dentry, &autofs4_dentry_operations);
-
                /*
                 * A dentry that is not within the root can never trigger a
                 * mount operation, unless the directory already exists, so we
@@ -512,12 +505,10 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
                        return ERR_PTR(-ENOENT);
 
                /* Mark entries in the root as mount triggers */
-               if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) {
-                       d_set_d_op(dentry, &autofs4_mount_dentry_operations);
+               if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
                        __managed_dentry_set_managed(dentry);
-               }
 
-               ino = autofs4_init_ino(NULL, sbi, 0555);
+               ino = autofs4_init_ino(NULL, sbi);
                if (!ino)
                        return ERR_PTR(-ENOMEM);
 
@@ -547,7 +538,7 @@ static int autofs4_dir_symlink(struct inode *dir,
        if (!autofs4_oz_mode(sbi))
                return -EACCES;
 
-       ino = autofs4_init_ino(ino, sbi, S_IFLNK | 0555);
+       ino = autofs4_init_ino(ino, sbi);
        if (!ino)
                return -ENOMEM;
 
@@ -563,17 +554,16 @@ static int autofs4_dir_symlink(struct inode *dir,
 
        strcpy(cp, symname);
 
-       inode = autofs4_get_inode(dir->i_sb, ino);
+       inode = autofs4_get_inode(dir->i_sb, ino, S_IFLNK | 0555);
        if (!inode) {
                kfree(cp);
                if (!dentry->d_fsdata)
                        kfree(ino);
                return -ENOMEM;
        }
+       inode->i_private = cp;
        d_add(dentry, inode);
 
-       d_set_d_op(dentry, &autofs4_dentry_operations);
-
        dentry->d_fsdata = ino;
        ino->dentry = dget(dentry);
        atomic_inc(&ino->count);
@@ -581,7 +571,6 @@ static int autofs4_dir_symlink(struct inode *dir,
        if (p_ino && dentry->d_parent != dentry)
                atomic_inc(&p_ino->count);
 
-       ino->u.symlink = cp;
        dir->i_mtime = CURRENT_TIME;
 
        return 0;
@@ -744,13 +733,13 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        DPRINTK("dentry %p, creating %.*s",
                dentry, dentry->d_name.len, dentry->d_name.name);
 
-       ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
+       ino = autofs4_init_ino(ino, sbi);
        if (!ino)
                return -ENOMEM;
 
        autofs4_del_active(dentry);
 
-       inode = autofs4_get_inode(dir->i_sb, ino);
+       inode = autofs4_get_inode(dir->i_sb, ino, S_IFDIR | 0555);
        if (!inode) {
                if (!dentry->d_fsdata)
                        kfree(ino);
@@ -848,8 +837,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
 int is_autofs4_dentry(struct dentry *dentry)
 {
        return dentry && dentry->d_inode &&
-               (dentry->d_op == &autofs4_mount_dentry_operations ||
-                dentry->d_op == &autofs4_dentry_operations) &&
+               dentry->d_op == &autofs4_dentry_operations &&
                dentry->d_fsdata != NULL;
 }