Skip to content

Commit 1b38ef3

Browse files
braunerSasha Levin
authored andcommitted
gfs2: pass through holder from the VFS for freeze/thaw
[ Upstream commit 62a2175 ] The filesystem's freeze/thaw functions can be called from contexts where the holder isn't userspace but the kernel, e.g., during systemd suspend/hibernate. So pass through the freeze/thaw flags from the VFS instead of hard-coding them. Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f01d819 commit 1b38ef3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/gfs2/super.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,15 +674,15 @@ static int gfs2_sync_fs(struct super_block *sb, int wait)
674674
return sdp->sd_log_error;
675675
}
676676

677-
static int gfs2_do_thaw(struct gfs2_sbd *sdp)
677+
static int gfs2_do_thaw(struct gfs2_sbd *sdp, enum freeze_holder who)
678678
{
679679
struct super_block *sb = sdp->sd_vfs;
680680
int error;
681681

682682
error = gfs2_freeze_lock_shared(sdp);
683683
if (error)
684684
goto fail;
685-
error = thaw_super(sb, FREEZE_HOLDER_USERSPACE);
685+
error = thaw_super(sb, who);
686686
if (!error)
687687
return 0;
688688

@@ -710,7 +710,7 @@ void gfs2_freeze_func(struct work_struct *work)
710710
gfs2_freeze_unlock(sdp);
711711
set_bit(SDF_FROZEN, &sdp->sd_flags);
712712

713-
error = gfs2_do_thaw(sdp);
713+
error = gfs2_do_thaw(sdp, FREEZE_HOLDER_USERSPACE);
714714
if (error)
715715
goto out;
716716

@@ -728,6 +728,7 @@ void gfs2_freeze_func(struct work_struct *work)
728728
/**
729729
* gfs2_freeze_super - prevent further writes to the filesystem
730730
* @sb: the VFS structure for the filesystem
731+
* @who: freeze flags
731732
*
732733
*/
733734

@@ -744,7 +745,7 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
744745
}
745746

746747
for (;;) {
747-
error = freeze_super(sb, FREEZE_HOLDER_USERSPACE);
748+
error = freeze_super(sb, who);
748749
if (error) {
749750
fs_info(sdp, "GFS2: couldn't freeze filesystem: %d\n",
750751
error);
@@ -758,7 +759,7 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
758759
break;
759760
}
760761

761-
error = gfs2_do_thaw(sdp);
762+
error = gfs2_do_thaw(sdp, who);
762763
if (error)
763764
goto out;
764765

@@ -796,6 +797,7 @@ static int gfs2_freeze_fs(struct super_block *sb)
796797
/**
797798
* gfs2_thaw_super - reallow writes to the filesystem
798799
* @sb: the VFS structure for the filesystem
800+
* @who: freeze flags
799801
*
800802
*/
801803

@@ -814,7 +816,7 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
814816
atomic_inc(&sb->s_active);
815817
gfs2_freeze_unlock(sdp);
816818

817-
error = gfs2_do_thaw(sdp);
819+
error = gfs2_do_thaw(sdp, who);
818820

819821
if (!error) {
820822
clear_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags);

0 commit comments

Comments
 (0)