From: Eric Sandeen <sandeen@sandeen.net>
To: Takashi Sato <t-sato@yk.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
"viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
"xfs@oss.sgi.com" <xfs@oss.sgi.com>,
"mtk.manpages@googlemail.com" <mtk.manpages@googlemail.com>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/3] freeze feature ver 1.14
Date: Thu, 01 Jan 2009 23:22:16 -0600 [thread overview]
Message-ID: <495DA488.7080702@sandeen.net> (raw)
In-Reply-To: <20081027215811t-sato@mail.jp.nec.com>
In lieu of the timeout feature which was originally proposed, how
about access to an emergency un-freeze via magic sysrq, maybe
piggy-backed on emergency sync... something like this (not
tested or even built yet...), would this be a good compromise to
help save people from frozen roots?
-Eric
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/drivers/md/dm.c
===================================================================
--- linux-2.6.orig/drivers/md/dm.c
+++ linux-2.6/drivers/md/dm.c
@@ -1477,7 +1477,7 @@ static void unlock_fs(struct mapped_devi
if (!test_bit(DMF_FROZEN, &md->flags))
return;
- thaw_bdev(md->suspended_bdev, md->frozen_sb);
+ thaw_bdev(md->suspended_bdev, md->frozen_sb, 0);
md->frozen_sb = NULL;
clear_bit(DMF_FROZEN, &md->flags);
}
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -259,13 +259,29 @@ struct super_block *freeze_bdev(struct b
EXPORT_SYMBOL(freeze_bdev);
/**
+ * emergency_thaw -- force thaw every filesystem
+ *
+ * Used for emergency unfreeze of all filesystems via SysRq
+ */
+void emergency_thaw(void)
+{
+ struct super_block *sb;
+
+ list_for_each_entry(sb, &super_blocks, s_list) {
+ if (sb->s_bdev)
+ (void)thaw_bdev(sb->s_bdev, sb, 1);
+ }
+}
+
+/**
* thaw_bdev -- unlock filesystem
* @bdev: blockdevice to unlock
* @sb: associated superblock
+ * force: force unfreeze regardless of freezer count
*
* Unlocks the filesystem and marks it writeable again after freeze_bdev().
*/
-int thaw_bdev(struct block_device *bdev, struct super_block *sb)
+int thaw_bdev(struct block_device *bdev, struct super_block *sb, int force)
{
int error = 0;
@@ -275,7 +291,11 @@ int thaw_bdev(struct block_device *bdev,
return -EINVAL;
}
- bdev->bd_fsfreeze_count--;
+ if (force)
+ bdev->bd_fsfreeze_count = 0;
+ else
+ bdev->bd_fsfreeze_count--;
+
if (bdev->bd_fsfreeze_count > 0) {
if (sb)
drop_super(sb);
Index: linux-2.6/fs/ioctl.c
===================================================================
--- linux-2.6.orig/fs/ioctl.c
+++ linux-2.6/fs/ioctl.c
@@ -449,7 +449,7 @@ static int ioctl_fsthaw(struct file *fil
return -EINVAL;
/* Thaw */
- return thaw_bdev(sb->s_bdev, sb);
+ return thaw_bdev(sb->s_bdev, sb, 0);
}
/*
Index: linux-2.6/fs/xfs/xfs_fsops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_fsops.c
+++ linux-2.6/fs/xfs/xfs_fsops.c
@@ -634,7 +634,7 @@ xfs_fs_goingdown(
if (sb && !IS_ERR(sb)) {
xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
- thaw_bdev(sb->s_bdev, sb);
+ thaw_bdev(sb->s_bdev, sb, 0);
}
break;
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,7 +171,8 @@ 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 *);
-int thaw_bdev(struct block_device *, struct super_block *);
+void emergency_thaw(void);
+int thaw_bdev(struct block_device *, struct super_block *, int);
int fsync_super(struct super_block *);
int fsync_no_super(struct block_device *);
struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
WARNING: multiple messages have this Message-ID (diff)
From: Eric Sandeen <sandeen@sandeen.net>
To: Takashi Sato <t-sato@yk.jp.nec.com>
Cc: "axboe@kernel.dk" <axboe@kernel.dk>,
"mtk.manpages@googlemail.com" <mtk.manpages@googlemail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xfs@oss.sgi.com" <xfs@oss.sgi.com>,
Christoph Hellwig <hch@infradead.org>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
"viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 0/3] freeze feature ver 1.14
Date: Thu, 01 Jan 2009 23:22:16 -0600 [thread overview]
Message-ID: <495DA488.7080702@sandeen.net> (raw)
In-Reply-To: <20081027215811t-sato@mail.jp.nec.com>
In lieu of the timeout feature which was originally proposed, how
about access to an emergency un-freeze via magic sysrq, maybe
piggy-backed on emergency sync... something like this (not
tested or even built yet...), would this be a good compromise to
help save people from frozen roots?
-Eric
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/drivers/md/dm.c
===================================================================
--- linux-2.6.orig/drivers/md/dm.c
+++ linux-2.6/drivers/md/dm.c
@@ -1477,7 +1477,7 @@ static void unlock_fs(struct mapped_devi
if (!test_bit(DMF_FROZEN, &md->flags))
return;
- thaw_bdev(md->suspended_bdev, md->frozen_sb);
+ thaw_bdev(md->suspended_bdev, md->frozen_sb, 0);
md->frozen_sb = NULL;
clear_bit(DMF_FROZEN, &md->flags);
}
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -259,13 +259,29 @@ struct super_block *freeze_bdev(struct b
EXPORT_SYMBOL(freeze_bdev);
/**
+ * emergency_thaw -- force thaw every filesystem
+ *
+ * Used for emergency unfreeze of all filesystems via SysRq
+ */
+void emergency_thaw(void)
+{
+ struct super_block *sb;
+
+ list_for_each_entry(sb, &super_blocks, s_list) {
+ if (sb->s_bdev)
+ (void)thaw_bdev(sb->s_bdev, sb, 1);
+ }
+}
+
+/**
* thaw_bdev -- unlock filesystem
* @bdev: blockdevice to unlock
* @sb: associated superblock
+ * force: force unfreeze regardless of freezer count
*
* Unlocks the filesystem and marks it writeable again after freeze_bdev().
*/
-int thaw_bdev(struct block_device *bdev, struct super_block *sb)
+int thaw_bdev(struct block_device *bdev, struct super_block *sb, int force)
{
int error = 0;
@@ -275,7 +291,11 @@ int thaw_bdev(struct block_device *bdev,
return -EINVAL;
}
- bdev->bd_fsfreeze_count--;
+ if (force)
+ bdev->bd_fsfreeze_count = 0;
+ else
+ bdev->bd_fsfreeze_count--;
+
if (bdev->bd_fsfreeze_count > 0) {
if (sb)
drop_super(sb);
Index: linux-2.6/fs/ioctl.c
===================================================================
--- linux-2.6.orig/fs/ioctl.c
+++ linux-2.6/fs/ioctl.c
@@ -449,7 +449,7 @@ static int ioctl_fsthaw(struct file *fil
return -EINVAL;
/* Thaw */
- return thaw_bdev(sb->s_bdev, sb);
+ return thaw_bdev(sb->s_bdev, sb, 0);
}
/*
Index: linux-2.6/fs/xfs/xfs_fsops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_fsops.c
+++ linux-2.6/fs/xfs/xfs_fsops.c
@@ -634,7 +634,7 @@ xfs_fs_goingdown(
if (sb && !IS_ERR(sb)) {
xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
- thaw_bdev(sb->s_bdev, sb);
+ thaw_bdev(sb->s_bdev, sb, 0);
}
break;
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,7 +171,8 @@ 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 *);
-int thaw_bdev(struct block_device *, struct super_block *);
+void emergency_thaw(void);
+int thaw_bdev(struct block_device *, struct super_block *, int);
int fsync_super(struct super_block *);
int fsync_no_super(struct block_device *);
struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-01-02 5:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-27 12:58 [PATCH 0/3] freeze feature ver 1.14 Takashi Sato
2008-10-27 12:58 ` Takashi Sato
2009-01-02 5:22 ` Eric Sandeen [this message]
2009-01-02 5:22 ` Eric Sandeen
2009-01-02 9:47 ` Christoph Hellwig
2009-01-02 9:47 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2008-10-27 12:58 Takashi Sato
2008-10-27 12:58 Takashi Sato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=495DA488.7080702@sandeen.net \
--to=sandeen@sandeen.net \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=hch@infradead.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@googlemail.com \
--cc=t-sato@yk.jp.nec.com \
--cc=viro@ZenIV.linux.org.uk \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.