Commit c2d75438 authored by Eric Sandeen's avatar Eric Sandeen Committed by Linus Torvalds
Browse files

filesystem freeze: allow SysRq emergency thaw to thaw frozen filesystems

Now that the filesystem freeze operation has been elevated to the VFS, and
is just an ioctl away, some sort of safety net for unintentionally frozen
root filesystems may be in order.

The timeout thaw originally proposed did not get merged, but perhaps
something like this would be useful in emergencies.

For example, freeze /path/to/mountpoint may freeze your root filesystem if
you forgot that you had that unmounted.

I chose 'j' as the last remaining character other than 'h' which is sort
of reserved for help (because help is generated on any unknown character).

I've tested this on a non-root fs with multiple (nested) freezers, as well
as on a system rendered unresponsive due to a frozen root fs.

[ emergency thaw only if CONFIG_BLOCK enabled]
Signed-off-by: default avatarEric Sandeen <>
Cc: Takashi Sato <>
Signed-off-by: default avatarRandy Dunlap <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 55a63998
......@@ -81,6 +81,8 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
'i' - Send a SIGKILL to all processes, except for init.
'j' - Forcibly "Just thaw it" - filesystems frozen by the FIFREEZE ioctl.
'k' - Secure Access Key (SAK) Kills all programs on the current virtual
console. NOTE: See important comments below in SAK section.
......@@ -160,6 +162,9 @@ t'E'rm and k'I'll are useful if you have some sort of runaway process you
are unable to kill any other way, especially if it's spawning other
"'J'ust thaw it" is useful if your system becomes unresponsive due to a frozen
(probably root) filesystem via the FIFREEZE ioctl.
* Sometimes SysRq seems to get 'stuck' after using it, what can I do?
That happens to me, also. I've found that tapping shift, alt, and control
......@@ -346,6 +346,19 @@ static struct sysrq_key_op sysrq_moom_op = {
.enable_mask = SYSRQ_ENABLE_SIGNAL,
static void sysrq_handle_thaw(int key, struct tty_struct *tty)
static struct sysrq_key_op sysrq_thaw_op = {
.handler = sysrq_handle_thaw,
.help_msg = "thaw-filesystems(J)",
.action_msg = "Emergency Thaw of all frozen filesystems",
.enable_mask = SYSRQ_ENABLE_SIGNAL,
static void sysrq_handle_kill(int key, struct tty_struct *tty)
......@@ -396,9 +409,13 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
&sysrq_moom_op, /* f */
/* g: May be registered by ppc for kgdb */
NULL, /* g */
NULL, /* h */
NULL, /* h - reserved for help */
&sysrq_kill_op, /* i */
&sysrq_thaw_op, /* j */
NULL, /* j */
&sysrq_SAK_op, /* k */
&sysrq_showallcpus_op, /* l */
......@@ -547,6 +547,39 @@ repeat:
return err;
void do_thaw_all(unsigned long unused)
struct super_block *sb;
list_for_each_entry(sb, &super_blocks, s_list) {
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
printk(KERN_WARNING "Emergency Thaw on %s\n",
bdevname(sb->s_bdev, b));
if (__put_super_and_need_restart(sb))
goto restart;
printk(KERN_WARNING "Emergency Thaw complete\n");
* emergency_thaw_all -- forcibly thaw every frozen filesystem
* Used for emergency unfreeze of all filesystems via SysRq
void emergency_thaw_all(void)
pdflush_operation(do_thaw_all, 0);
* sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers
* @mapping: the mapping which wants those buffers written
......@@ -1878,6 +1878,7 @@ extern struct block_device *open_by_devnum(dev_t, fmode_t);
extern void invalidate_bdev(struct block_device *);
extern int sync_blockdev(struct block_device *bdev);
extern struct super_block *freeze_bdev(struct block_device *);
extern void emergency_thaw_all(void);
extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
extern int fsync_bdev(struct block_device *);
extern int fsync_super(struct super_block *);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment