linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow SysRq emergency sync to thaw frozen filesystems
@ 2009-01-15  4:06 Eric Sandeen
  2009-01-16  0:20 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Eric Sandeen @ 2009-01-15  4:06 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel Mailing List; +Cc: Andrew Morton, Takashi Sato

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.

This doesn't have to piggyback on the existing emergency sync
sysrq, but it seems like a reasonable, simple addition to me.

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.

Thanks,
-Eric

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Index: linux-2.6/drivers/char/sysrq.c
===================================================================
--- linux-2.6.orig/drivers/char/sysrq.c
+++ linux-2.6/drivers/char/sysrq.c
@@ -151,6 +151,7 @@ static struct sysrq_key_op sysrq_reboot_
 
 static void sysrq_handle_sync(int key, struct tty_struct *tty)
 {
+	emergency_thaw();
 	emergency_sync();
 }
 static struct sysrq_key_op sysrq_sync_op = {
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -258,6 +258,29 @@ struct super_block *freeze_bdev(struct b
 }
 EXPORT_SYMBOL(freeze_bdev);
 
+void do_thaw(unsigned long unused)
+{
+	struct super_block *sb;
+	char b[BDEVNAME_SIZE];
+
+	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));
+	}
+	printk(KERN_WARNING "Emergency Thaw complete\n");
+}
+
+/**
+ * emergency_thaw -- force thaw every filesystem
+ *
+ * Used for emergency unfreeze of all filesystems via SysRq
+ */
+void emergency_thaw(void)
+{
+	pdflush_operation(do_thaw, 0);
+}
+
 /**
  * thaw_bdev  -- unlock filesystem
  * @bdev:	blockdevice to unlock
Index: linux-2.6/include/linux/buffer_head.h
===================================================================
--- linux-2.6.orig/include/linux/buffer_head.h
+++ linux-2.6/include/linux/buffer_head.h
@@ -171,6 +171,7 @@ void __wait_on_buffer(struct buffer_head
 wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
 int fsync_bdev(struct block_device *);
 struct super_block *freeze_bdev(struct block_device *);
+void emergency_thaw(void);
 int thaw_bdev(struct block_device *, struct super_block *);
 int fsync_super(struct super_block *);
 int fsync_no_super(struct block_device *);
Index: linux-2.6/Documentation/sysrq.txt
===================================================================
--- linux-2.6.orig/Documentation/sysrq.txt
+++ linux-2.6/Documentation/sysrq.txt
@@ -101,7 +101,8 @@ On all -  write a character to /proc/sys
 
 'r'     - Turns off keyboard raw mode and sets it to XLATE.
 
-'s'     - Will attempt to sync all mounted filesystems.
+'s'     - Will attempt to sync all mounted filesystems, and unfreeze
+	  any frozen fileystems.
 
 't'     - Will dump a list of current tasks and their information to your
           console.



^ permalink raw reply	[flat|nested] 30+ messages in thread
[parent not found: <bUrIs-Za-3@gated-at.bofh.it>]

end of thread, other threads:[~2009-02-16 22:01 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-15  4:06 [PATCH] Allow SysRq emergency sync to thaw frozen filesystems Eric Sandeen
2009-01-16  0:20 ` Andrew Morton
2009-01-16  3:49   ` Eric Sandeen
2009-01-16  3:59     ` Eric Sandeen
2009-01-16 15:33       ` Valdis.Kletnieks
2009-01-16 15:40         ` Eric Sandeen
2009-01-16 16:21     ` Dave Kleikamp
2009-01-16 16:42       ` Dave Kleikamp
2009-01-16  8:48 ` Pavel Machek
2009-01-16 15:17   ` Valdis.Kletnieks
2009-01-16 15:28     ` Eric Sandeen
2009-01-16 15:33     ` Pavel Machek
2009-01-16 15:40     ` Theodore Tso
2009-01-16 15:52       ` Valdis.Kletnieks
2009-01-16 16:08       ` Eric Sandeen
2009-01-16 19:31 ` [PATCH V2] Allow SysRq emergency thaw " Eric Sandeen
2009-01-16 19:38   ` Randy Dunlap
2009-01-16 19:46     ` Eric Sandeen
2009-01-16 19:50   ` [PATCH V3] " Eric Sandeen
2009-01-30 21:40     ` Andrew Morton
2009-02-02 22:55       ` [PATCH V4] " Eric Sandeen
2009-02-03 11:48         ` Jamie Lokier
2009-02-03 13:31           ` Dave Kleikamp
2009-02-03 21:21           ` Dave Chinner
2009-02-03 22:01         ` Andrew Morton
2009-02-03 22:07           ` Eric Sandeen
2009-02-03 22:21             ` Andrew Morton
2009-02-16 22:01           ` [PATCH V5] " Eric Sandeen
     [not found] <bUrIs-Za-3@gated-at.bofh.it>
     [not found] ` <bUKL7-6vo-3@gated-at.bofh.it>
     [not found]   ` <bUNSJ-2Vn-13@gated-at.bofh.it>
     [not found]     ` <bUO2t-376-5@gated-at.bofh.it>
     [not found]       ` <bUYXL-3Qb-25@gated-at.bofh.it>
     [not found]         ` <bUZ7p-448-9@gated-at.bofh.it>
2009-01-17 14:03           ` [PATCH] Allow SysRq emergency sync " Bodo Eggert
2009-01-17 15:44             ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).