Skip to content

Commit ff132c5

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: report "already frozen/thawed" errors
Before this patch, gfs2's freeze function failed to report an error when the target file system was already frozen as it should (and as generic vfs function freeze_super does. Similarly, gfs2's thaw function failed to report an error when trying to thaw a file system that is not frozen, as vfs function thaw_super does. The errors were checked, but it always returned a 0 return code. This patch adds the missing error return codes to gfs2 freeze and thaw. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 62dd0f9 commit ff132c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/gfs2/super.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,11 +752,13 @@ void gfs2_freeze_func(struct work_struct *work)
752752
static int gfs2_freeze(struct super_block *sb)
753753
{
754754
struct gfs2_sbd *sdp = sb->s_fs_info;
755-
int error = 0;
755+
int error;
756756

757757
mutex_lock(&sdp->sd_freeze_mutex);
758-
if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
758+
if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) {
759+
error = -EBUSY;
759760
goto out;
761+
}
760762

761763
for (;;) {
762764
if (gfs2_withdrawn(sdp)) {
@@ -797,10 +799,10 @@ static int gfs2_unfreeze(struct super_block *sb)
797799
struct gfs2_sbd *sdp = sb->s_fs_info;
798800

799801
mutex_lock(&sdp->sd_freeze_mutex);
800-
if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
802+
if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
801803
!gfs2_holder_initialized(&sdp->sd_freeze_gh)) {
802804
mutex_unlock(&sdp->sd_freeze_mutex);
803-
return 0;
805+
return -EINVAL;
804806
}
805807

806808
gfs2_freeze_unlock(&sdp->sd_freeze_gh);

0 commit comments

Comments
 (0)