pidfs: remove config option
[linux-2.6-block.git] / fs / libfs.c
index 0d14ae808fcfdb314af5b95ccabec10f1dac8c15..3a6f2cb364f8cbcc9fa78d6a0a45519ad6fcd696 100644 (file)
@@ -2001,34 +2001,40 @@ static inline struct dentry *get_stashed_dentry(struct dentry *stashed)
 }
 
 static struct dentry *prepare_anon_dentry(struct dentry **stashed,
-                                         unsigned long ino,
                                          struct super_block *sb,
                                          void *data)
 {
        struct dentry *dentry;
        struct inode *inode;
        const struct stashed_operations *sops = sb->s_fs_info;
-
-       dentry = d_alloc_anon(sb);
-       if (!dentry)
-               return ERR_PTR(-ENOMEM);
+       int ret;
 
        inode = new_inode_pseudo(sb);
        if (!inode) {
-               dput(dentry);
+               sops->put_data(data);
                return ERR_PTR(-ENOMEM);
        }
 
-       inode->i_ino = ino;
        inode->i_flags |= S_IMMUTABLE;
        inode->i_mode = S_IFREG;
        simple_inode_init_ts(inode);
-       sops->init_inode(inode, data);
+
+       ret = sops->init_inode(inode, data);
+       if (ret < 0) {
+               iput(inode);
+               return ERR_PTR(ret);
+       }
 
        /* Notice when this is changed. */
        WARN_ON_ONCE(!S_ISREG(inode->i_mode));
        WARN_ON_ONCE(!IS_IMMUTABLE(inode));
 
+       dentry = d_alloc_anon(sb);
+       if (!dentry) {
+               iput(inode);
+               return ERR_PTR(-ENOMEM);
+       }
+
        /* Store address of location where dentry's supposed to be stashed. */
        dentry->d_fsdata = stashed;
 
@@ -2062,7 +2068,6 @@ static struct dentry *stash_dentry(struct dentry **stashed,
 /**
  * path_from_stashed - create path from stashed or new dentry
  * @stashed:    where to retrieve or stash dentry
- * @ino:        inode number to use
  * @mnt:        mnt of the filesystems to use
  * @data:       data to store in inode->i_private
  * @path:       path to create
@@ -2077,8 +2082,8 @@ static struct dentry *stash_dentry(struct dentry **stashed,
  *
  * Return: On success zero and on failure a negative error is returned.
  */
-int path_from_stashed(struct dentry **stashed, unsigned long ino,
-                     struct vfsmount *mnt, void *data, struct path *path)
+int path_from_stashed(struct dentry **stashed, struct vfsmount *mnt, void *data,
+                     struct path *path)
 {
        struct dentry *dentry;
        const struct stashed_operations *sops = mnt->mnt_sb->s_fs_info;
@@ -2091,11 +2096,9 @@ int path_from_stashed(struct dentry **stashed, unsigned long ino,
        }
 
        /* Allocate a new dentry. */
-       dentry = prepare_anon_dentry(stashed, ino, mnt->mnt_sb, data);
-       if (IS_ERR(dentry)) {
-               sops->put_data(data);
+       dentry = prepare_anon_dentry(stashed, mnt->mnt_sb, data);
+       if (IS_ERR(dentry))
                return PTR_ERR(dentry);
-       }
 
        /* Added a new dentry. @data is now owned by the filesystem. */
        path->dentry = stash_dentry(stashed, dentry);