Commit 5a7a9646 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Minor gfs2_{freeze,thaw}_super cleanup

This minor cleanup to gfs2_freeze_super() and gfs2_thaw_super() prepares
for the following refcounting fix.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent edd13270
...@@ -759,9 +759,10 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who) ...@@ -759,9 +759,10 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
if (!mutex_trylock(&sdp->sd_freeze_mutex)) if (!mutex_trylock(&sdp->sd_freeze_mutex))
return -EBUSY; return -EBUSY;
error = -EBUSY; if (test_bit(SDF_FROZEN, &sdp->sd_flags)) {
if (test_bit(SDF_FROZEN, &sdp->sd_flags)) mutex_unlock(&sdp->sd_freeze_mutex);
goto out; return -EBUSY;
}
for (;;) { for (;;) {
error = gfs2_freeze_locally(sdp); error = gfs2_freeze_locally(sdp);
...@@ -772,8 +773,11 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who) ...@@ -772,8 +773,11 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
} }
error = gfs2_lock_fs_check_clean(sdp); error = gfs2_lock_fs_check_clean(sdp);
if (!error) if (!error) {
break; /* success */ set_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags);
set_bit(SDF_FROZEN, &sdp->sd_flags);
break;
}
error = gfs2_do_thaw(sdp); error = gfs2_do_thaw(sdp);
if (error) if (error)
...@@ -793,10 +797,6 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who) ...@@ -793,10 +797,6 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
} }
out: out:
if (!error) {
set_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags);
set_bit(SDF_FROZEN, &sdp->sd_flags);
}
mutex_unlock(&sdp->sd_freeze_mutex); mutex_unlock(&sdp->sd_freeze_mutex);
return error; return error;
} }
...@@ -814,9 +814,10 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who) ...@@ -814,9 +814,10 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
if (!mutex_trylock(&sdp->sd_freeze_mutex)) if (!mutex_trylock(&sdp->sd_freeze_mutex))
return -EBUSY; return -EBUSY;
error = -EINVAL; if (!test_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags)) {
if (!test_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags)) mutex_unlock(&sdp->sd_freeze_mutex);
goto out; return -EINVAL;
}
gfs2_freeze_unlock(&sdp->sd_freeze_gh); gfs2_freeze_unlock(&sdp->sd_freeze_gh);
...@@ -826,7 +827,6 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who) ...@@ -826,7 +827,6 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
clear_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags); clear_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags);
clear_bit(SDF_FROZEN, &sdp->sd_flags); clear_bit(SDF_FROZEN, &sdp->sd_flags);
} }
out:
mutex_unlock(&sdp->sd_freeze_mutex); mutex_unlock(&sdp->sd_freeze_mutex);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment