aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@opteron.9grid.us>2008-05-08 21:26:37 -0400
committerEric Van Hensbergen <ericvh@opteron.9grid.us>2008-05-14 20:23:27 -0400
commit887b3ece65be7b643dfdae0d433c91a26a3f437d (patch)
tree471889dcdd3f7eb6762d863fef236014c63a0301 /fs
parent332c421e67045343de74e644cdf389f559f0d83f (diff)
9p: fix error path during early mount
There was some cleanup issues during early mount which would trigger a kernel bug for certain types of failure. This patch reorganizes the cleanup to get rid of the bad behavior. This also merges the 9pnet and 9pnet_fd modules for the purpose of configuration and initialization. Keeping the fd transport separate from the core 9pnet code seemed like a good idea at the time, but in practice has caused more harm and confusion than good. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/v9fs.c13
-rw-r--r--fs/9p/vfs_super.c34
2 files changed, 23 insertions, 24 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 5c1ccaf0416c..047c791427aa 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -206,12 +206,14 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
206 v9ses->uid = ~0; 206 v9ses->uid = ~0;
207 v9ses->dfltuid = V9FS_DEFUID; 207 v9ses->dfltuid = V9FS_DEFUID;
208 v9ses->dfltgid = V9FS_DEFGID; 208 v9ses->dfltgid = V9FS_DEFGID;
209 v9ses->options = kstrdup(data, GFP_KERNEL); 209 if (data) {
210 if (!v9ses->options) { 210 v9ses->options = kstrdup(data, GFP_KERNEL);
211 P9_DPRINTK(P9_DEBUG_ERROR, 211 if (!v9ses->options) {
212 P9_DPRINTK(P9_DEBUG_ERROR,
212 "failed to allocate copy of option string\n"); 213 "failed to allocate copy of option string\n");
213 retval = -ENOMEM; 214 retval = -ENOMEM;
214 goto error; 215 goto error;
216 }
215 } 217 }
216 218
217 rc = v9fs_parse_options(v9ses); 219 rc = v9fs_parse_options(v9ses);
@@ -260,7 +262,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
260 return fid; 262 return fid;
261 263
262error: 264error:
263 v9fs_session_close(v9ses);
264 return ERR_PTR(retval); 265 return ERR_PTR(retval);
265} 266}
266 267
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