Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f73ca1b76c6880b934d3ef566c1592efc80bb759
Commit:     f73ca1b76c6880b934d3ef566c1592efc80bb759
Parent:     88bf7b391dca840f03fe25e4ff8fe6b4319fa07b
Author:     David Chinner <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 10 23:15:41 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Jan 11 18:18:21 2007 -0800

    [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 <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/block_dev.c       |    2 +-
 fs/buffer.c          |    6 +++---
 fs/gfs2/ops_fstype.c |    4 ++--
 fs/super.c           |    4 ++--
 include/linux/fs.h   |    2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 1715d6b..8b18e43 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
        {
                memset(bdev, 0, sizeof(*bdev));
                mutex_init(&bdev->bd_mutex);
-               mutex_init(&bdev->bd_mount_mutex);
+               sema_init(&bdev->bd_mount_sem, 1);
                INIT_LIST_HEAD(&bdev->bd_inodes);
                INIT_LIST_HEAD(&bdev->bd_list);
 #ifdef CONFIG_SYSFS
diff --git a/fs/buffer.c b/fs/buffer.c
index 263f88e..3b11607 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -180,7 +180,7 @@ int fsync_bdev(struct block_device *bdev)
  * freeze_bdev  --  lock a filesystem and force it into a consistent state
  * @bdev:      blockdevice to lock
  *
- * This takes the block device bd_mount_mutex to make sure no new mounts
+ * This takes the block device bd_mount_sem to make sure no new mounts
  * happen on bdev until thaw_bdev() is called.
  * If a superblock is found on this device, we take the s_umount semaphore
  * 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)
 {
        struct super_block *sb;
 
-       mutex_lock(&bdev->bd_mount_mutex);
+       down(&bdev->bd_mount_sem);
        sb = get_super(bdev);
        if (sb && !(sb->s_flags & MS_RDONLY)) {
                sb->s_frozen = SB_FREEZE_WRITE;
@@ -231,7 +231,7 @@ void thaw_bdev(struct block_device *bdev, struct 
super_block *sb)
                drop_super(sb);
        }
 
-       mutex_unlock(&bdev->bd_mount_mutex);
+       up(&bdev->bd_mount_sem);
 }
 EXPORT_SYMBOL(thaw_bdev);
 
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d14e139..ee80b8a 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,
                error = -EBUSY;
                goto error;
        }
-       mutex_lock(&sb->s_bdev->bd_mount_mutex);
+       down(&sb->s_bdev->bd_mount_sem);
        new = sget(fs_type, test_bdev_super, set_bdev_super, sb->s_bdev);
-       mutex_unlock(&sb->s_bdev->bd_mount_mutex);
+       up(&sb->s_bdev->bd_mount_sem);
        if (IS_ERR(new)) {
                error = PTR_ERR(new);
                goto error;
diff --git a/fs/super.c b/fs/super.c
index f961e03..3e7458c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -753,9 +753,9 @@ int get_sb_bdev(struct file_system_type *fs_type,
         * will protect the lockfs code from trying to start a snapshot
         * while we are mounting
         */
-       mutex_lock(&bdev->bd_mount_mutex);
+       down(&bdev->bd_mount_sem);
        s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
-       mutex_unlock(&bdev->bd_mount_mutex);
+       up(&bdev->bd_mount_sem);
        if (IS_ERR(s))
                goto error_s;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 14a337c..1410e53 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -459,7 +459,7 @@ struct block_device {
        struct inode *          bd_inode;       /* will die */
        int                     bd_openers;
        struct mutex            bd_mutex;       /* open/close mutex */
-       struct mutex            bd_mount_mutex; /* mount mutex */
+       struct semaphore        bd_mount_sem;
        struct list_head        bd_inodes;
        void *                  bd_holder;
        int                     bd_holders;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to