[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070929100912.GB4121@APFDCB5C>
Date: Sat, 29 Sep 2007 19:09:12 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: linux-kernel@...r.kernel.org
Cc: xfs@....sgi.com, Tim Shimmin <xfs-masters@....sgi.com>,
Christoph Hellwig <hch@....de>
Subject: [PATCH] update sb->s_frozen when freezing read-only mounted device, too
freeze_bdev() with the device which is mounted as read only
does not change sb->s_frozen from SB_UNFROZEN to SB_FREEZE_TRANS.
Because of this behavior, xfs_freeze can break read-only XFS filesystem.
Because xfs_thaw does nothing for the filesystem whose sb->s_frozen is
SB_UNFROZEN. So freezed readonly XFS filesystem will never be unfreezed.
Then we cannot do any unmount/remount operations for that filesystem.
This patch updates sb->s_frozen when freeze_bdev() is called for read-only
mounted device, too.
Cc: Tim Shimmin <xfs-masters@....sgi.com>
Cc: Christoph Hellwig <hch@....de>
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
---
fs/buffer.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
Index: 2.6-git/fs/buffer.c
===================================================================
--- 2.6-git.orig/fs/buffer.c
+++ 2.6-git/fs/buffer.c
@@ -190,19 +190,22 @@ struct super_block *freeze_bdev(struct b
down(&bdev->bd_mount_sem);
sb = get_super(bdev);
- if (sb && !(sb->s_flags & MS_RDONLY)) {
+ if (sb) {
sb->s_frozen = SB_FREEZE_WRITE;
smp_wmb();
- __fsync_super(sb);
+ if (!(sb->s_flags & MS_RDONLY))
+ __fsync_super(sb);
sb->s_frozen = SB_FREEZE_TRANS;
smp_wmb();
- sync_blockdev(sb->s_bdev);
+ if (!(sb->s_flags & MS_RDONLY)) {
+ sync_blockdev(sb->s_bdev);
- if (sb->s_op->write_super_lockfs)
- sb->s_op->write_super_lockfs(sb);
+ if (sb->s_op->write_super_lockfs)
+ sb->s_op->write_super_lockfs(sb);
+ }
}
sync_blockdev(bdev);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists