diff options
author | David Chinner <dgc@sgi.com> | 2007-01-11 02:15:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-11 21:18:21 -0500 |
commit | f73ca1b76c6880b934d3ef566c1592efc80bb759 (patch) | |
tree | c9384ef5ff0ba68817858afdcc330e8707b11ec9 /fs | |
parent | 88bf7b391dca840f03fe25e4ff8fe6b4319fa07b (diff) |
[PATCH] Revert bd_mount_mutex back to a semaphore
Revert bd_mount_mutex back to a semaphore so that xfs_freeze -f /mnt/newtest;
xfs_freeze -u /mnt/newtest works safely and doesn't produce lockdep warnings.
(XFS unlocks the semaphore from a different task, by design. The mutex
code warns about this)
Signed-off-by: Dave Chinner <dgc@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 2 | ||||
-rw-r--r-- | fs/buffer.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 4 | ||||
-rw-r--r-- | fs/super.c | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 1715d6b5f411..8b18e43b82fe 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -411,7 +411,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
411 | { | 411 | { |
412 | memset(bdev, 0, sizeof(*bdev)); | 412 | memset(bdev, 0, sizeof(*bdev)); |
413 | mutex_init(&bdev->bd_mutex); | 413 | mutex_init(&bdev->bd_mutex); |
414 | mutex_init(&bdev->bd_mount_mutex); | 414 | sema_init(&bdev->bd_mount_sem, 1); |
415 | INIT_LIST_HEAD(&bdev->bd_inodes); | 415 | INIT_LIST_HEAD(&bdev->bd_inodes); |
416 | INIT_LIST_HEAD(&bdev->bd_list); | 416 | INIT_LIST_HEAD(&bdev->bd_list); |
417 | #ifdef CONFIG_SYSFS | 417 | #ifdef CONFIG_SYSFS |
diff --git a/fs/buffer.c b/fs/buffer.c index 263f88e4dffb..3b116078b4c3 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -180,7 +180,7 @@ int fsync_bdev(struct block_device *bdev) | |||
180 | * freeze_bdev -- lock a filesystem and force it into a consistent state | 180 | * freeze_bdev -- lock a filesystem and force it into a consistent state |
181 | * @bdev: blockdevice to lock | 181 | * @bdev: blockdevice to lock |
182 | * | 182 | * |
183 | * This takes the block device bd_mount_mutex to make sure no new mounts | 183 | * This takes the block device bd_mount_sem to make sure no new mounts |
184 | * happen on bdev until thaw_bdev() is called. | 184 | * happen on bdev until thaw_bdev() is called. |
185 | * If a superblock is found on this device, we take the s_umount semaphore | 185 | * If a superblock is found on this device, we take the s_umount semaphore |
186 | * on it to make sure nobody unmounts until the snapshot creation is done. | 186 | * on it to make sure nobody unmounts until the snapshot creation is done. |
@@ -189,7 +189,7 @@ struct super_block *freeze_bdev(struct block_device *bdev) | |||
189 | { | 189 | { |
190 | struct super_block *sb; | 190 | struct super_block *sb; |
191 | 191 | ||
192 | mutex_lock(&bdev->bd_mount_mutex); | 192 | down(&bdev->bd_mount_sem); |
193 | sb = get_super(bdev); | 193 | sb = get_super(bdev); |
194 | if (sb && !(sb->s_flags & MS_RDONLY)) { | 194 | if (sb && !(sb->s_flags & MS_RDONLY)) { |
195 | sb->s_frozen = SB_FREEZE_WRITE; | 195 | sb->s_frozen = SB_FREEZE_WRITE; |
@@ -231,7 +231,7 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb) | |||
231 | drop_super(sb); | 231 | drop_super(sb); |
232 | } | 232 | } |
233 | 233 | ||
234 | mutex_unlock(&bdev->bd_mount_mutex); | 234 | up(&bdev->bd_mount_sem); |
235 | } | 235 | } |
236 | EXPORT_SYMBOL(thaw_bdev); | 236 | EXPORT_SYMBOL(thaw_bdev); |
237 | 237 | ||
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index d14e139d2674..ee80b8a5e7bc 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -867,9 +867,9 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, | |||
867 | error = -EBUSY; | 867 | error = -EBUSY; |
868 | goto error; | 868 | goto error; |
869 | } | 869 | } |
870 | mutex_lock(&sb->s_bdev->bd_mount_mutex); | 870 | down(&sb->s_bdev->bd_mount_sem); |
871 | new = sget(fs_type, test_bdev_super, set_bdev_super, sb->s_bdev); | 871 | new = sget(fs_type, test_bdev_super, set_bdev_super, sb->s_bdev); |
872 | mutex_unlock(&sb->s_bdev->bd_mount_mutex); | 872 | up(&sb->s_bdev->bd_mount_sem); |
873 | if (IS_ERR(new)) { | 873 | if (IS_ERR(new)) { |
874 | error = PTR_ERR(new); | 874 | error = PTR_ERR(new); |
875 | goto error; | 875 | goto error; |
diff --git a/fs/super.c b/fs/super.c index f961e0307997..3e7458c2bb76 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -753,9 +753,9 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
753 | * will protect the lockfs code from trying to start a snapshot | 753 | * will protect the lockfs code from trying to start a snapshot |
754 | * while we are mounting | 754 | * while we are mounting |
755 | */ | 755 | */ |
756 | mutex_lock(&bdev->bd_mount_mutex); | 756 | down(&bdev->bd_mount_sem); |
757 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); | 757 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); |
758 | mutex_unlock(&bdev->bd_mount_mutex); | 758 | up(&bdev->bd_mount_sem); |
759 | if (IS_ERR(s)) | 759 | if (IS_ERR(s)) |
760 | goto error_s; | 760 | goto error_s; |
761 | 761 | ||