It turns out that the .freeze_super and .thaw_super operations require
the filesystem to manage the superblock refcount itself.  We are using
the freeze_super() and thaw_super() helpers to mostly take care of that
for us, but this means that the superblock may no longer be around by
when thaw_super() returns, and gfs2_thaw_super() will then access freed
memory.  Take an extra superblock reference in gfs2_thaw_super() to fix
that.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
                return -EINVAL;
        }
 
+       atomic_inc(&sb->s_active);
        gfs2_freeze_unlock(&sdp->sd_freeze_gh);
 
        error = gfs2_do_thaw(sdp);
                clear_bit(SDF_FROZEN, &sdp->sd_flags);
        }
        mutex_unlock(&sdp->sd_freeze_mutex);
+       deactivate_super(sb);
        return error;
 }