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.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index ba10f172626d..bf59c3960494 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -128,29 +128,26 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
128 fid = v9fs_session_init(v9ses, dev_name, data); 128 fid = v9fs_session_init(v9ses, dev_name, data);
129 if (IS_ERR(fid)) { 129 if (IS_ERR(fid)) {
130 retval = PTR_ERR(fid); 130 retval = PTR_ERR(fid);
131 fid = NULL; 131 goto close_session;
132 kfree(v9ses);
133 v9ses = NULL;
134 goto error;
135 } 132 }
136 133
137 st = p9_client_stat(fid); 134 st = p9_client_stat(fid);
138 if (IS_ERR(st)) { 135 if (IS_ERR(st)) {
139 retval = PTR_ERR(st); 136 retval = PTR_ERR(st);
140 goto error; 137 goto clunk_fid;
141 } 138 }
142 139
143 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 140 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
144 if (IS_ERR(sb)) { 141 if (IS_ERR(sb)) {
145 retval = PTR_ERR(sb); 142 retval = PTR_ERR(sb);
146 goto error; 143 goto free_stat;
147 } 144 }
148 v9fs_fill_super(sb, v9ses, flags); 145 v9fs_fill_super(sb, v9ses, flags);
149 146
150 inode = v9fs_get_inode(sb, S_IFDIR | mode); 147 inode = v9fs_get_inode(sb, S_IFDIR | mode);
151 if (IS_ERR(inode)) { 148 if (IS_ERR(inode)) {
152 retval = PTR_ERR(inode); 149 retval = PTR_ERR(inode);
153 goto error; 150 goto release_sb;
154 } 151 }
155 152
156 inode->i_uid = uid; 153 inode->i_uid = uid;
@@ -159,7 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
159 root = d_alloc_root(inode); 156 root = d_alloc_root(inode);
160 if (!root) { 157 if (!root) {
161 retval = -ENOMEM; 158 retval = -ENOMEM;
162 goto error; 159 goto release_sb;
163 } 160 }
164 161
165 sb->s_root = root; 162 sb->s_root = root;
@@ -170,21 +167,22 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
170 167
171 return simple_set_mnt(mnt, sb); 168 return simple_set_mnt(mnt, sb);
172 169
173error: 170release_sb:
174 kfree(st);
175 if (fid)
176 p9_client_clunk(fid);
177
178 if (v9ses) {
179 v9fs_session_close(v9ses);
180 kfree(v9ses);
181 }
182
183 if (sb) { 171 if (sb) {
184 up_write(&sb->s_umount); 172 up_write(&sb->s_umount);
185 deactivate_super(sb); 173 deactivate_super(sb);
186 } 174 }
187 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
188 return retval; 186 return retval;
189} 187}
190 188