Commit 5c25f347a7b00b2ebe0a55c4a3cfe4c3e1e8725e
Committed by
Eric Van Hensbergen
1 parent
62b2be591a
Exists in
master
and in
7 other branches
fs/9p: Fix error handling in v9fs_get_sb
This was introduced by 7cadb63d58a932041afa3f957d5cbb6ce69dcee5 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Showing 1 changed file with 14 additions and 6 deletions Side-by-side Diff
fs/9p/vfs_super.c
... | ... | @@ -122,6 +122,10 @@ |
122 | 122 | fid = v9fs_session_init(v9ses, dev_name, data); |
123 | 123 | if (IS_ERR(fid)) { |
124 | 124 | retval = PTR_ERR(fid); |
125 | + /* | |
126 | + * we need to call session_close to tear down some | |
127 | + * of the data structure setup by session_init | |
128 | + */ | |
125 | 129 | goto close_session; |
126 | 130 | } |
127 | 131 | |
... | ... | @@ -144,7 +148,6 @@ |
144 | 148 | retval = -ENOMEM; |
145 | 149 | goto release_sb; |
146 | 150 | } |
147 | - | |
148 | 151 | sb->s_root = root; |
149 | 152 | |
150 | 153 | if (v9fs_proto_dotl(v9ses)) { |
... | ... | @@ -152,7 +155,7 @@ |
152 | 155 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); |
153 | 156 | if (IS_ERR(st)) { |
154 | 157 | retval = PTR_ERR(st); |
155 | - goto clunk_fid; | |
158 | + goto release_sb; | |
156 | 159 | } |
157 | 160 | |
158 | 161 | v9fs_stat2inode_dotl(st, root->d_inode); |
... | ... | @@ -162,7 +165,7 @@ |
162 | 165 | st = p9_client_stat(fid); |
163 | 166 | if (IS_ERR(st)) { |
164 | 167 | retval = PTR_ERR(st); |
165 | - goto clunk_fid; | |
168 | + goto release_sb; | |
166 | 169 | } |
167 | 170 | |
168 | 171 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); |
169 | 172 | |
170 | 173 | |
171 | 174 | |
... | ... | @@ -174,19 +177,24 @@ |
174 | 177 | |
175 | 178 | v9fs_fid_add(root, fid); |
176 | 179 | |
177 | -P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
180 | + P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |
178 | 181 | simple_set_mnt(mnt, sb); |
179 | 182 | return 0; |
180 | 183 | |
181 | 184 | clunk_fid: |
182 | 185 | p9_client_clunk(fid); |
183 | - | |
184 | 186 | close_session: |
185 | 187 | v9fs_session_close(v9ses); |
186 | 188 | kfree(v9ses); |
187 | 189 | return retval; |
188 | - | |
189 | 190 | release_sb: |
191 | + /* | |
192 | + * we will do the session_close and root dentry release | |
193 | + * in the below call. But we need to clunk fid, because we haven't | |
194 | + * attached the fid to dentry so it won't get clunked | |
195 | + * automatically. | |
196 | + */ | |
197 | + p9_client_clunk(fid); | |
190 | 198 | deactivate_locked_super(sb); |
191 | 199 | return retval; |
192 | 200 | } |