diff options
Diffstat (limited to 'fs/9p/vfs_super.c')
| -rw-r--r-- | fs/9p/vfs_super.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 868f350b2c5f..82c5b0084079 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -129,8 +129,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
| 129 | 129 | ||
| 130 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { | 130 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { |
| 131 | dprintk(DEBUG_ERROR, "problem initiating session\n"); | 131 | dprintk(DEBUG_ERROR, "problem initiating session\n"); |
| 132 | retval = newfid; | 132 | return ERR_PTR(newfid); |
| 133 | goto free_session; | ||
| 134 | } | 133 | } |
| 135 | 134 | ||
| 136 | sb = sget(fs_type, NULL, v9fs_set_super, v9ses); | 135 | sb = sget(fs_type, NULL, v9fs_set_super, v9ses); |
| @@ -150,28 +149,24 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
| 150 | 149 | ||
| 151 | if (!root) { | 150 | if (!root) { |
| 152 | retval = -ENOMEM; | 151 | retval = -ENOMEM; |
| 153 | goto release_inode; | 152 | goto put_back_sb; |
| 154 | } | 153 | } |
| 155 | 154 | ||
| 156 | sb->s_root = root; | 155 | sb->s_root = root; |
| 157 | 156 | ||
| 158 | /* Setup the Root Inode */ | ||
| 159 | root_fid = v9fs_fid_create(root); | ||
| 160 | if (root_fid == NULL) { | ||
| 161 | retval = -ENOMEM; | ||
| 162 | goto release_dentry; | ||
| 163 | } | ||
| 164 | |||
| 165 | root_fid->fidopen = 0; | ||
| 166 | root_fid->v9ses = v9ses; | ||
| 167 | |||
| 168 | stat_result = v9fs_t_stat(v9ses, newfid, &fcall); | 157 | stat_result = v9fs_t_stat(v9ses, newfid, &fcall); |
| 169 | if (stat_result < 0) { | 158 | if (stat_result < 0) { |
| 170 | dprintk(DEBUG_ERROR, "stat error\n"); | 159 | dprintk(DEBUG_ERROR, "stat error\n"); |
| 171 | v9fs_t_clunk(v9ses, newfid, NULL); | 160 | v9fs_t_clunk(v9ses, newfid, NULL); |
| 172 | v9fs_put_idpool(newfid, &v9ses->fidpool); | 161 | v9fs_put_idpool(newfid, &v9ses->fidpool); |
| 173 | } else { | 162 | } else { |
| 174 | root_fid->fid = newfid; | 163 | /* Setup the Root Inode */ |
| 164 | root_fid = v9fs_fid_create(root, v9ses, newfid, 0); | ||
| 165 | if (root_fid == NULL) { | ||
| 166 | retval = -ENOMEM; | ||
| 167 | goto put_back_sb; | ||
| 168 | } | ||
| 169 | |||
| 175 | root_fid->qid = fcall->params.rstat.stat->qid; | 170 | root_fid->qid = fcall->params.rstat.stat->qid; |
| 176 | root->d_inode->i_ino = | 171 | root->d_inode->i_ino = |
| 177 | v9fs_qid2ino(&fcall->params.rstat.stat->qid); | 172 | v9fs_qid2ino(&fcall->params.rstat.stat->qid); |
| @@ -182,25 +177,15 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
| 182 | 177 | ||
| 183 | if (stat_result < 0) { | 178 | if (stat_result < 0) { |
| 184 | retval = stat_result; | 179 | retval = stat_result; |
| 185 | goto release_dentry; | 180 | goto put_back_sb; |
| 186 | } | 181 | } |
| 187 | 182 | ||
| 188 | return sb; | 183 | return sb; |
| 189 | 184 | ||
| 190 | release_dentry: | 185 | put_back_sb: |
| 191 | dput(sb->s_root); | 186 | /* deactivate_super calls v9fs_kill_super which will frees the rest */ |
| 192 | |||
| 193 | release_inode: | ||
| 194 | iput(inode); | ||
| 195 | |||
| 196 | put_back_sb: | ||
| 197 | up_write(&sb->s_umount); | 187 | up_write(&sb->s_umount); |
| 198 | deactivate_super(sb); | 188 | deactivate_super(sb); |
| 199 | v9fs_session_close(v9ses); | ||
| 200 | |||
| 201 | free_session: | ||
| 202 | kfree(v9ses); | ||
| 203 | |||
| 204 | return ERR_PTR(retval); | 189 | return ERR_PTR(retval); |
| 205 | } | 190 | } |
| 206 | 191 | ||
