... and the same failure exits cleanup for ocfs2
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 13 Feb 2012 02:46:49 +0000 (21:46 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 21 Mar 2012 01:29:34 +0000 (21:29 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ocfs2/super.c

index 604e12c4e97946a1d6a65bde559402372508c6f9..2b1184f7097ff8458fd627f45cd1fe81476e7d0d 100644 (file)
@@ -1154,12 +1154,12 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        status = ocfs2_mount_volume(sb);
-       if (osb->root_inode)
-               inode = igrab(osb->root_inode);
-
        if (status < 0)
                goto read_super_error;
 
+       if (osb->root_inode)
+               inode = igrab(osb->root_inode);
+
        if (!inode) {
                status = -EIO;
                mlog_errno(status);
@@ -1168,6 +1168,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 
        root = d_alloc_root(inode);
        if (!root) {
+               iput(inode);
                status = -ENOMEM;
                mlog_errno(status);
                goto read_super_error;
@@ -1220,9 +1221,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 read_super_error:
        brelse(bh);
 
-       if (inode)
-               iput(inode);
-
        if (osb) {
                atomic_set(&osb->vol_state, VOLUME_DISABLED);
                wake_up(&osb->osb_mount_event);