gfs2: Don't loop forever in gfs2_freeze if withdrawn
authorBob Peterson <rpeterso@redhat.com>
Thu, 14 Nov 2019 14:53:36 +0000 (09:53 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 14 Nov 2019 18:47:05 +0000 (19:47 +0100)
Before this patch, function gfs2_freeze would loop forever if the
filesystem it tries to freeze is withdrawn. That's because function
gfs2_lock_fs_check_clean tries to enqueue the glock of the journal and
the gfs2_glock returns -EIO because you can't enqueue a journaled glock
after a withdraw.

Move the check for file system withdraw inside the loop so that the loop
can end when withdraw occurs.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/super.c

index 478015b..8154c38 100644 (file)
@@ -761,12 +761,12 @@ static int gfs2_freeze(struct super_block *sb)
        if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
                goto out;
 
-       if (gfs2_withdrawn(sdp)) {
-               error = -EINVAL;
-               goto out;
-       }
-
        for (;;) {
+               if (gfs2_withdrawn(sdp)) {
+                       error = -EINVAL;
+                       goto out;
+               }
+
                error = gfs2_lock_fs_check_clean(sdp, &sdp->sd_freeze_gh);
                if (!error)
                        break;