From: Arjan van de Ven The fat code uses the fat_lock always in a mutex way (taking and releasing the lock in the same function), the patch below converts it into the new mutex primitive. Please consider this patch for the code. Signed-off-by: Arjan van de Ven Acked-by: OGAWA Hirofumi Cc: Ingo Molnar Signed-off-by: Andrew Morton --- fs/fat/fatent.c | 6 +++--- include/linux/msdos_fs.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff -puN fs/fat/fatent.c~fat_lock-is-used-as-a-mutex-convert-it-to-using-the-new-mutex fs/fat/fatent.c --- devel/fs/fat/fatent.c~fat_lock-is-used-as-a-mutex-convert-it-to-using-the-new-mutex 2006-01-15 22:11:44.000000000 -0800 +++ devel-akpm/fs/fat/fatent.c 2006-01-15 22:11:44.000000000 -0800 @@ -267,19 +267,19 @@ static struct fatent_operations fat32_op static inline void lock_fat(struct msdos_sb_info *sbi) { - down(&sbi->fat_lock); + mutex_lock(&sbi->fat_lock); } static inline void unlock_fat(struct msdos_sb_info *sbi) { - up(&sbi->fat_lock); + mutex_unlock(&sbi->fat_lock); } void fat_ent_access_init(struct super_block *sb) { struct msdos_sb_info *sbi = MSDOS_SB(sb); - init_MUTEX(&sbi->fat_lock); + mutex_init(&sbi->fat_lock); switch (sbi->fat_bits) { case 32: diff -puN include/linux/msdos_fs.h~fat_lock-is-used-as-a-mutex-convert-it-to-using-the-new-mutex include/linux/msdos_fs.h --- devel/include/linux/msdos_fs.h~fat_lock-is-used-as-a-mutex-convert-it-to-using-the-new-mutex 2006-01-15 22:11:44.000000000 -0800 +++ devel-akpm/include/linux/msdos_fs.h 2006-01-15 22:11:44.000000000 -0800 @@ -184,6 +184,7 @@ struct fat_slot_info { #include #include #include +#include struct fat_mount_options { uid_t fs_uid; @@ -226,7 +227,7 @@ struct msdos_sb_info { unsigned long max_cluster; /* maximum cluster number */ unsigned long root_cluster; /* first cluster of the root directory */ unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ - struct semaphore fat_lock; + struct mutex fat_lock; unsigned int prev_free; /* previously allocated cluster number */ unsigned int free_clusters; /* -1 if undefined */ struct fat_mount_options options; _