aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_super.c')
-rw-r--r--fs/9p/vfs_super.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index a452ac67fc94..bf59c3960494 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -75,6 +75,7 @@ static int v9fs_set_super(struct super_block *s, void *data)
75 * v9fs_fill_super - populate superblock with info 75 * v9fs_fill_super - populate superblock with info
76 * @sb: superblock 76 * @sb: superblock
77 * @v9ses: session information 77 * @v9ses: session information
78 * @flags: flags propagated from v9fs_get_sb()
78 * 79 *
79 */ 80 */
80 81
@@ -127,29 +128,26 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
127 fid = v9fs_session_init(v9ses, dev_name, data); 128 fid = v9fs_session_init(v9ses, dev_name, data);
128 if (IS_ERR(fid)) { 129 if (IS_ERR(fid)) {
129 retval = PTR_ERR(fid); 130 retval = PTR_ERR(fid);
130 fid = NULL; 131 goto close_session;
131 kfree(v9ses);
132 v9ses = NULL;
133 goto error;
134 } 132 }
135 133
136 st = p9_client_stat(fid); 134 st = p9_client_stat(fid);
137 if (IS_ERR(st)) { 135 if (IS_ERR(st)) {
138 retval = PTR_ERR(st); 136 retval = PTR_ERR(st);
139 goto error; 137 goto clunk_fid;
140 } 138 }
141 139
142 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 140 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
143 if (IS_ERR(sb)) { 141 if (IS_ERR(sb)) {
144 retval = PTR_ERR(sb); 142 retval = PTR_ERR(sb);
145 goto error; 143 goto free_stat;
146 } 144 }
147 v9fs_fill_super(sb, v9ses, flags); 145 v9fs_fill_super(sb, v9ses, flags);
148 146
149 inode = v9fs_get_inode(sb, S_IFDIR | mode); 147 inode = v9fs_get_inode(sb, S_IFDIR | mode);
150 if (IS_ERR(inode)) { 148 if (IS_ERR(inode)) {
151 retval = PTR_ERR(inode); 149 retval = PTR_ERR(inode);
152 goto error; 150 goto release_sb;
153 } 151 }
154 152
155 inode->i_uid = uid; 153 inode->i_uid = uid;
@@ -158,7 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
158 root = d_alloc_root(inode); 156 root = d_alloc_root(inode);
159 if (!root) { 157 if (!root) {
160 retval = -ENOMEM; 158 retval = -ENOMEM;
161 goto error; 159 goto release_sb;
162 } 160 }
163 161
164 sb->s_root = root; 162 sb->s_root = root;
@@ -169,21 +167,22 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
169 167
170 return simple_set_mnt(mnt, sb); 168 return simple_set_mnt(mnt, sb);
171 169
172error: 170release_sb:
173 kfree(st);
174 if (fid)
175 p9_client_clunk(fid);
176
177 if (v9ses) {
178 v9fs_session_close(v9ses);
179 kfree(v9ses);
180 }
181
182 if (sb) { 171 if (sb) {
183 up_write(&sb->s_umount); 172 up_write(&sb->s_umount);
184 deactivate_super(sb); 173 deactivate_super(sb);
185 } 174 }
186 175
176free_stat:
177 kfree(st);
178
179clunk_fid:
180 p9_client_clunk(fid);
181
182close_session:
183 v9fs_session_close(v9ses);
184 kfree(v9ses);
185
187 return retval; 186 return retval;
188} 187}
189 188