mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
gfs2: pass through holder from the VFS for freeze/thaw
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>
This commit is contained in:
parent
b47e42d10e
commit
62a2175ddf
|
|
@ -674,7 +674,7 @@ static int gfs2_sync_fs(struct super_block *sb, int wait)
|
|||
return sdp->sd_log_error;
|
||||
}
|
||||
|
||||
static int gfs2_do_thaw(struct gfs2_sbd *sdp)
|
||||
static int gfs2_do_thaw(struct gfs2_sbd *sdp, enum freeze_holder who)
|
||||
{
|
||||
struct super_block *sb = sdp->sd_vfs;
|
||||
int error;
|
||||
|
|
@ -682,7 +682,7 @@ static int gfs2_do_thaw(struct gfs2_sbd *sdp)
|
|||
error = gfs2_freeze_lock_shared(sdp);
|
||||
if (error)
|
||||
goto fail;
|
||||
error = thaw_super(sb, FREEZE_HOLDER_USERSPACE);
|
||||
error = thaw_super(sb, who);
|
||||
if (!error)
|
||||
return 0;
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ void gfs2_freeze_func(struct work_struct *work)
|
|||
gfs2_freeze_unlock(sdp);
|
||||
set_bit(SDF_FROZEN, &sdp->sd_flags);
|
||||
|
||||
error = gfs2_do_thaw(sdp);
|
||||
error = gfs2_do_thaw(sdp, FREEZE_HOLDER_USERSPACE);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
|
@ -728,6 +728,7 @@ void gfs2_freeze_func(struct work_struct *work)
|
|||
/**
|
||||
* gfs2_freeze_super - prevent further writes to the filesystem
|
||||
* @sb: the VFS structure for the filesystem
|
||||
* @who: freeze flags
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -744,7 +745,7 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
error = freeze_super(sb, FREEZE_HOLDER_USERSPACE);
|
||||
error = freeze_super(sb, who);
|
||||
if (error) {
|
||||
fs_info(sdp, "GFS2: couldn't freeze filesystem: %d\n",
|
||||
error);
|
||||
|
|
@ -758,7 +759,7 @@ static int gfs2_freeze_super(struct super_block *sb, enum freeze_holder who)
|
|||
break;
|
||||
}
|
||||
|
||||
error = gfs2_do_thaw(sdp);
|
||||
error = gfs2_do_thaw(sdp, who);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
|
@ -796,6 +797,7 @@ static int gfs2_freeze_fs(struct super_block *sb)
|
|||
/**
|
||||
* gfs2_thaw_super - reallow writes to the filesystem
|
||||
* @sb: the VFS structure for the filesystem
|
||||
* @who: freeze flags
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -814,7 +816,7 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
|
|||
atomic_inc(&sb->s_active);
|
||||
gfs2_freeze_unlock(sdp);
|
||||
|
||||
error = gfs2_do_thaw(sdp);
|
||||
error = gfs2_do_thaw(sdp, who);
|
||||
|
||||
if (!error) {
|
||||
clear_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user