diff options
-rw-r--r-- | fs/minix/inode.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 62c697caffb9..fcb05d2c6b5f 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -254,14 +254,6 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
254 | minix_set_bit(0,sbi->s_imap[0]->b_data); | 254 | minix_set_bit(0,sbi->s_imap[0]->b_data); |
255 | minix_set_bit(0,sbi->s_zmap[0]->b_data); | 255 | minix_set_bit(0,sbi->s_zmap[0]->b_data); |
256 | 256 | ||
257 | /* set up enough so that it can read an inode */ | ||
258 | s->s_op = &minix_sops; | ||
259 | root_inode = minix_iget(s, MINIX_ROOT_INO); | ||
260 | if (IS_ERR(root_inode)) { | ||
261 | ret = PTR_ERR(root_inode); | ||
262 | goto out_no_root; | ||
263 | } | ||
264 | |||
265 | /* Apparently minix can create filesystems that allocate more blocks for | 257 | /* Apparently minix can create filesystems that allocate more blocks for |
266 | * the bitmaps than needed. We simply ignore that, but verify it didn't | 258 | * the bitmaps than needed. We simply ignore that, but verify it didn't |
267 | * create one with not enough blocks and bail out if so. | 259 | * create one with not enough blocks and bail out if so. |
@@ -270,7 +262,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
270 | if (sbi->s_imap_blocks < block) { | 262 | if (sbi->s_imap_blocks < block) { |
271 | printk("MINIX-fs: file system does not have enough " | 263 | printk("MINIX-fs: file system does not have enough " |
272 | "imap blocks allocated. Refusing to mount\n"); | 264 | "imap blocks allocated. Refusing to mount\n"); |
273 | goto out_iput; | 265 | goto out_no_bitmap; |
274 | } | 266 | } |
275 | 267 | ||
276 | block = minix_blocks_needed( | 268 | block = minix_blocks_needed( |
@@ -279,13 +271,21 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
279 | if (sbi->s_zmap_blocks < block) { | 271 | if (sbi->s_zmap_blocks < block) { |
280 | printk("MINIX-fs: file system does not have enough " | 272 | printk("MINIX-fs: file system does not have enough " |
281 | "zmap blocks allocated. Refusing to mount.\n"); | 273 | "zmap blocks allocated. Refusing to mount.\n"); |
282 | goto out_iput; | 274 | goto out_no_bitmap; |
275 | } | ||
276 | |||
277 | /* set up enough so that it can read an inode */ | ||
278 | s->s_op = &minix_sops; | ||
279 | root_inode = minix_iget(s, MINIX_ROOT_INO); | ||
280 | if (IS_ERR(root_inode)) { | ||
281 | ret = PTR_ERR(root_inode); | ||
282 | goto out_no_root; | ||
283 | } | 283 | } |
284 | 284 | ||
285 | ret = -ENOMEM; | 285 | ret = -ENOMEM; |
286 | s->s_root = d_alloc_root(root_inode); | 286 | s->s_root = d_make_root(root_inode); |
287 | if (!s->s_root) | 287 | if (!s->s_root) |
288 | goto out_iput; | 288 | goto out_no_root; |
289 | 289 | ||
290 | if (!(s->s_flags & MS_RDONLY)) { | 290 | if (!(s->s_flags & MS_RDONLY)) { |
291 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 291 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ |
@@ -301,10 +301,6 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
301 | 301 | ||
302 | return 0; | 302 | return 0; |
303 | 303 | ||
304 | out_iput: | ||
305 | iput(root_inode); | ||
306 | goto out_freemap; | ||
307 | |||
308 | out_no_root: | 304 | out_no_root: |
309 | if (!silent) | 305 | if (!silent) |
310 | printk("MINIX-fs: get root inode failed\n"); | 306 | printk("MINIX-fs: get root inode failed\n"); |