return -EAGAIN;
        dp->low_ino = i;
 
-       spin_lock(&proc_subdir_lock);
-       dp->next = dir->subdir;
-       dp->parent = dir;
-       dir->subdir = dp;
-       spin_unlock(&proc_subdir_lock);
-
        if (S_ISDIR(dp->mode)) {
                if (dp->proc_iops == NULL) {
                        dp->proc_fops = &proc_dir_operations;
                if (dp->proc_iops == NULL)
                        dp->proc_iops = &proc_file_inode_operations;
        }
+
+       spin_lock(&proc_subdir_lock);
+       dp->next = dir->subdir;
+       dp->parent = dir;
+       dir->subdir = dp;
+       spin_unlock(&proc_subdir_lock);
+
        return 0;
 }
 
 
        ent = proc_create(&parent, name, S_IFDIR | mode, 2);
        if (ent) {
-               ent->proc_fops = &proc_dir_operations;
-               ent->proc_iops = &proc_dir_inode_operations;
-
                if (proc_register(parent, ent) < 0) {
                        kfree(ent);
                        ent = NULL;
 
        ent = proc_create(&parent,name,mode,nlink);
        if (ent) {
-               if (S_ISDIR(mode)) {
-                       ent->proc_fops = &proc_dir_operations;
-                       ent->proc_iops = &proc_dir_inode_operations;
-               }
                if (proc_register(parent, ent) < 0) {
                        kfree(ent);
                        ent = NULL;