diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2022-08-18 16:12:24 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2023-07-03 22:30:23 +0200 |
commit | 5432af15f8772d5e1a44d59d6ffcd513da8436b4 (patch) | |
tree | cbceceac890506ff5400e53960d3640790d0078e /fs/gfs2/super.c | |
parent | b77b4a4815a9651d1d6e07b8e6548eee9531a5eb (diff) |
gfs2: Replace sd_freeze_state with SDF_FROZEN flag
Replace sd_freeze_state with a new SDF_FROZEN flag.
There no longer is a need for indicating that a freeze is in progress
(SDF_STARTING_FREEZE); we are now protecting the critical sections with
the sd_freeze_mutex.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 81c8d07a4540..6dcbfb9b9306 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -689,26 +689,19 @@ static int gfs2_freeze_locally(struct gfs2_sbd *sdp) struct super_block *sb = sdp->sd_vfs; int error; - atomic_set(&sdp->sd_freeze_state, SFS_STARTING_FREEZE); - error = freeze_super(sb); if (error) - goto fail; + return error; if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_FREEZE | GFS2_LFC_FREEZE_GO_SYNC); if (gfs2_withdrawn(sdp)) { thaw_super(sb); - error = -EIO; - goto fail; + return -EIO; } } return 0; - -fail: - atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); - return error; } static int gfs2_do_thaw(struct gfs2_sbd *sdp) @@ -737,7 +730,7 @@ void gfs2_freeze_func(struct work_struct *work) mutex_lock(&sdp->sd_freeze_mutex); error = -EBUSY; - if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) + if (test_bit(SDF_FROZEN, &sdp->sd_flags)) goto freeze_failed; error = gfs2_freeze_locally(sdp); @@ -745,13 +738,13 @@ void gfs2_freeze_func(struct work_struct *work) goto freeze_failed; gfs2_freeze_unlock(&sdp->sd_freeze_gh); - atomic_set(&sdp->sd_freeze_state, SFS_FROZEN); + set_bit(SDF_FROZEN, &sdp->sd_flags); error = gfs2_do_thaw(sdp); if (error) goto out; - atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); + clear_bit(SDF_FROZEN, &sdp->sd_flags); goto out; freeze_failed: @@ -776,7 +769,7 @@ static int gfs2_freeze_super(struct super_block *sb) if (!mutex_trylock(&sdp->sd_freeze_mutex)) return -EBUSY; error = -EBUSY; - if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) + if (test_bit(SDF_FROZEN, &sdp->sd_flags)) goto out; for (;;) { @@ -811,7 +804,7 @@ static int gfs2_freeze_super(struct super_block *sb) out: if (!error) { set_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags); - atomic_set(&sdp->sd_freeze_state, SFS_FROZEN); + set_bit(SDF_FROZEN, &sdp->sd_flags); } mutex_unlock(&sdp->sd_freeze_mutex); return error; @@ -840,7 +833,7 @@ static int gfs2_thaw_super(struct super_block *sb) if (!error) { clear_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags); - atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); + clear_bit(SDF_FROZEN, &sdp->sd_flags); } out: mutex_unlock(&sdp->sd_freeze_mutex); |