diff options
| -rw-r--r-- | fs/cramfs/inode.c | 31 | ||||
| -rw-r--r-- | fs/dcookies.c | 19 | ||||
| -rw-r--r-- | fs/jffs2/compr_zlib.c | 19 | ||||
| -rw-r--r-- | fs/jfs/jfs_logmgr.c | 27 | ||||
| -rw-r--r-- | fs/lockd/host.c | 19 | ||||
| -rw-r--r-- | fs/lockd/svc.c | 17 | ||||
| -rw-r--r-- | fs/lockd/svcsubs.c | 17 | ||||
| -rw-r--r-- | fs/nfs/callback.c | 11 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 9 | ||||
| -rw-r--r-- | fs/partitions/devfs.c | 12 | ||||
| -rw-r--r-- | fs/super.c | 7 |
11 files changed, 99 insertions, 89 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 8ad52f5bf255..acc1b2c10a86 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/cramfs_fs_sb.h> | 22 | #include <linux/cramfs_fs_sb.h> |
| 23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
| 24 | #include <linux/vfs.h> | 24 | #include <linux/vfs.h> |
| 25 | #include <linux/mutex.h> | ||
| 25 | #include <asm/semaphore.h> | 26 | #include <asm/semaphore.h> |
| 26 | 27 | ||
| 27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
| @@ -31,7 +32,7 @@ static struct inode_operations cramfs_dir_inode_operations; | |||
| 31 | static struct file_operations cramfs_directory_operations; | 32 | static struct file_operations cramfs_directory_operations; |
| 32 | static struct address_space_operations cramfs_aops; | 33 | static struct address_space_operations cramfs_aops; |
| 33 | 34 | ||
| 34 | static DECLARE_MUTEX(read_mutex); | 35 | static DEFINE_MUTEX(read_mutex); |
| 35 | 36 | ||
| 36 | 37 | ||
| 37 | /* These two macros may change in future, to provide better st_ino | 38 | /* These two macros may change in future, to provide better st_ino |
| @@ -250,20 +251,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 250 | memset(sbi, 0, sizeof(struct cramfs_sb_info)); | 251 | memset(sbi, 0, sizeof(struct cramfs_sb_info)); |
| 251 | 252 | ||
| 252 | /* Invalidate the read buffers on mount: think disk change.. */ | 253 | /* Invalidate the read buffers on mount: think disk change.. */ |
| 253 | down(&read_mutex); | 254 | mutex_lock(&read_mutex); |
| 254 | for (i = 0; i < READ_BUFFERS; i++) | 255 | for (i = 0; i < READ_BUFFERS; i++) |
| 255 | buffer_blocknr[i] = -1; | 256 | buffer_blocknr[i] = -1; |
| 256 | 257 | ||
| 257 | /* Read the first block and get the superblock from it */ | 258 | /* Read the first block and get the superblock from it */ |
| 258 | memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super)); | 259 | memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super)); |
| 259 | up(&read_mutex); | 260 | mutex_unlock(&read_mutex); |
| 260 | 261 | ||
| 261 | /* Do sanity checks on the superblock */ | 262 | /* Do sanity checks on the superblock */ |
| 262 | if (super.magic != CRAMFS_MAGIC) { | 263 | if (super.magic != CRAMFS_MAGIC) { |
| 263 | /* check at 512 byte offset */ | 264 | /* check at 512 byte offset */ |
| 264 | down(&read_mutex); | 265 | mutex_lock(&read_mutex); |
| 265 | memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); | 266 | memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); |
| 266 | up(&read_mutex); | 267 | mutex_unlock(&read_mutex); |
| 267 | if (super.magic != CRAMFS_MAGIC) { | 268 | if (super.magic != CRAMFS_MAGIC) { |
| 268 | if (!silent) | 269 | if (!silent) |
| 269 | printk(KERN_ERR "cramfs: wrong magic\n"); | 270 | printk(KERN_ERR "cramfs: wrong magic\n"); |
| @@ -366,7 +367,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 366 | mode_t mode; | 367 | mode_t mode; |
| 367 | int namelen, error; | 368 | int namelen, error; |
| 368 | 369 | ||
| 369 | down(&read_mutex); | 370 | mutex_lock(&read_mutex); |
| 370 | de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256); | 371 | de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256); |
| 371 | name = (char *)(de+1); | 372 | name = (char *)(de+1); |
| 372 | 373 | ||
| @@ -379,7 +380,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 379 | memcpy(buf, name, namelen); | 380 | memcpy(buf, name, namelen); |
| 380 | ino = CRAMINO(de); | 381 | ino = CRAMINO(de); |
| 381 | mode = de->mode; | 382 | mode = de->mode; |
| 382 | up(&read_mutex); | 383 | mutex_unlock(&read_mutex); |
| 383 | nextoffset = offset + sizeof(*de) + namelen; | 384 | nextoffset = offset + sizeof(*de) + namelen; |
| 384 | for (;;) { | 385 | for (;;) { |
| 385 | if (!namelen) { | 386 | if (!namelen) { |
| @@ -410,7 +411,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s | |||
| 410 | unsigned int offset = 0; | 411 | unsigned int offset = 0; |
| 411 | int sorted; | 412 | int sorted; |
| 412 | 413 | ||
| 413 | down(&read_mutex); | 414 | mutex_lock(&read_mutex); |
| 414 | sorted = CRAMFS_SB(dir->i_sb)->flags & CRAMFS_FLAG_SORTED_DIRS; | 415 | sorted = CRAMFS_SB(dir->i_sb)->flags & CRAMFS_FLAG_SORTED_DIRS; |
| 415 | while (offset < dir->i_size) { | 416 | while (offset < dir->i_size) { |
| 416 | struct cramfs_inode *de; | 417 | struct cramfs_inode *de; |
| @@ -433,7 +434,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s | |||
| 433 | 434 | ||
| 434 | for (;;) { | 435 | for (;;) { |
| 435 | if (!namelen) { | 436 | if (!namelen) { |
| 436 | up(&read_mutex); | 437 | mutex_unlock(&read_mutex); |
| 437 | return ERR_PTR(-EIO); | 438 | return ERR_PTR(-EIO); |
| 438 | } | 439 | } |
| 439 | if (name[namelen-1]) | 440 | if (name[namelen-1]) |
| @@ -447,7 +448,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s | |||
| 447 | continue; | 448 | continue; |
| 448 | if (!retval) { | 449 | if (!retval) { |
| 449 | struct cramfs_inode entry = *de; | 450 | struct cramfs_inode entry = *de; |
| 450 | up(&read_mutex); | 451 | mutex_unlock(&read_mutex); |
| 451 | d_add(dentry, get_cramfs_inode(dir->i_sb, &entry)); | 452 | d_add(dentry, get_cramfs_inode(dir->i_sb, &entry)); |
| 452 | return NULL; | 453 | return NULL; |
| 453 | } | 454 | } |
| @@ -455,7 +456,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s | |||
| 455 | if (sorted) | 456 | if (sorted) |
| 456 | break; | 457 | break; |
| 457 | } | 458 | } |
| 458 | up(&read_mutex); | 459 | mutex_unlock(&read_mutex); |
| 459 | d_add(dentry, NULL); | 460 | d_add(dentry, NULL); |
| 460 | return NULL; | 461 | return NULL; |
| 461 | } | 462 | } |
| @@ -474,21 +475,21 @@ static int cramfs_readpage(struct file *file, struct page * page) | |||
| 474 | u32 start_offset, compr_len; | 475 | u32 start_offset, compr_len; |
| 475 | 476 | ||
| 476 | start_offset = OFFSET(inode) + maxblock*4; | 477 | start_offset = OFFSET(inode) + maxblock*4; |
| 477 | down(&read_mutex); | 478 | mutex_lock(&read_mutex); |
| 478 | if (page->index) | 479 | if (page->index) |
| 479 | start_offset = *(u32 *) cramfs_read(sb, blkptr_offset-4, 4); | 480 | start_offset = *(u32 *) cramfs_read(sb, blkptr_offset-4, 4); |
| 480 | compr_len = (*(u32 *) cramfs_read(sb, blkptr_offset, 4) - start_offset); | 481 | compr_len = (*(u32 *) cramfs_read(sb, blkptr_offset, 4) - start_offset); |
| 481 | up(&read_mutex); | 482 | mutex_unlock(&read_mutex); |
| 482 | pgdata = kmap(page); | 483 | pgdata = kmap(page); |
| 483 | if (compr_len == 0) | 484 | if (compr_len == 0) |
| 484 | ; /* hole */ | 485 | ; /* hole */ |
| 485 | else { | 486 | else { |
| 486 | down(&read_mutex); | 487 | mutex_lock(&read_mutex); |
| 487 | bytes_filled = cramfs_uncompress_block(pgdata, | 488 | bytes_filled = cramfs_uncompress_block(pgdata, |
| 488 | PAGE_CACHE_SIZE, | 489 | PAGE_CACHE_SIZE, |
| 489 | cramfs_read(sb, start_offset, compr_len), | 490 | cramfs_read(sb, start_offset, compr_len), |
| 490 | compr_len); | 491 | compr_len); |
| 491 | up(&read_mutex); | 492 | mutex_unlock(&read_mutex); |
| 492 | } | 493 | } |
| 493 | } else | 494 | } else |
| 494 | pgdata = kmap(page); | 495 | pgdata = kmap(page); |
diff --git a/fs/dcookies.c b/fs/dcookies.c index f8274a8f83bd..ef758cfa5565 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| 24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
| 25 | #include <linux/dcookies.h> | 25 | #include <linux/dcookies.h> |
| 26 | #include <linux/mutex.h> | ||
| 26 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
| 27 | 28 | ||
| 28 | /* The dcookies are allocated from a kmem_cache and | 29 | /* The dcookies are allocated from a kmem_cache and |
| @@ -36,7 +37,7 @@ struct dcookie_struct { | |||
| 36 | }; | 37 | }; |
| 37 | 38 | ||
| 38 | static LIST_HEAD(dcookie_users); | 39 | static LIST_HEAD(dcookie_users); |
| 39 | static DECLARE_MUTEX(dcookie_sem); | 40 | static DEFINE_MUTEX(dcookie_mutex); |
| 40 | static kmem_cache_t * dcookie_cache; | 41 | static kmem_cache_t * dcookie_cache; |
| 41 | static struct list_head * dcookie_hashtable; | 42 | static struct list_head * dcookie_hashtable; |
| 42 | static size_t hash_size; | 43 | static size_t hash_size; |
| @@ -114,7 +115,7 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
| 114 | int err = 0; | 115 | int err = 0; |
| 115 | struct dcookie_struct * dcs; | 116 | struct dcookie_struct * dcs; |
| 116 | 117 | ||
| 117 | down(&dcookie_sem); | 118 | mutex_lock(&dcookie_mutex); |
| 118 | 119 | ||
| 119 | if (!is_live()) { | 120 | if (!is_live()) { |
| 120 | err = -EINVAL; | 121 | err = -EINVAL; |
| @@ -134,7 +135,7 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, | |||
| 134 | *cookie = dcookie_value(dcs); | 135 | *cookie = dcookie_value(dcs); |
| 135 | 136 | ||
| 136 | out: | 137 | out: |
| 137 | up(&dcookie_sem); | 138 | mutex_unlock(&dcookie_mutex); |
| 138 | return err; | 139 | return err; |
| 139 | } | 140 | } |
| 140 | 141 | ||
| @@ -157,7 +158,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) | |||
| 157 | if (!capable(CAP_SYS_ADMIN)) | 158 | if (!capable(CAP_SYS_ADMIN)) |
| 158 | return -EPERM; | 159 | return -EPERM; |
| 159 | 160 | ||
| 160 | down(&dcookie_sem); | 161 | mutex_lock(&dcookie_mutex); |
| 161 | 162 | ||
| 162 | if (!is_live()) { | 163 | if (!is_live()) { |
| 163 | err = -EINVAL; | 164 | err = -EINVAL; |
| @@ -192,7 +193,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) | |||
| 192 | out_free: | 193 | out_free: |
| 193 | kfree(kbuf); | 194 | kfree(kbuf); |
| 194 | out: | 195 | out: |
| 195 | up(&dcookie_sem); | 196 | mutex_unlock(&dcookie_mutex); |
| 196 | return err; | 197 | return err; |
| 197 | } | 198 | } |
| 198 | 199 | ||
| @@ -290,7 +291,7 @@ struct dcookie_user * dcookie_register(void) | |||
| 290 | { | 291 | { |
| 291 | struct dcookie_user * user; | 292 | struct dcookie_user * user; |
| 292 | 293 | ||
| 293 | down(&dcookie_sem); | 294 | mutex_lock(&dcookie_mutex); |
| 294 | 295 | ||
| 295 | user = kmalloc(sizeof(struct dcookie_user), GFP_KERNEL); | 296 | user = kmalloc(sizeof(struct dcookie_user), GFP_KERNEL); |
| 296 | if (!user) | 297 | if (!user) |
| @@ -302,7 +303,7 @@ struct dcookie_user * dcookie_register(void) | |||
| 302 | list_add(&user->next, &dcookie_users); | 303 | list_add(&user->next, &dcookie_users); |
| 303 | 304 | ||
| 304 | out: | 305 | out: |
| 305 | up(&dcookie_sem); | 306 | mutex_unlock(&dcookie_mutex); |
| 306 | return user; | 307 | return user; |
| 307 | out_free: | 308 | out_free: |
| 308 | kfree(user); | 309 | kfree(user); |
| @@ -313,7 +314,7 @@ out_free: | |||
| 313 | 314 | ||
| 314 | void dcookie_unregister(struct dcookie_user * user) | 315 | void dcookie_unregister(struct dcookie_user * user) |
| 315 | { | 316 | { |
| 316 | down(&dcookie_sem); | 317 | mutex_lock(&dcookie_mutex); |
| 317 | 318 | ||
| 318 | list_del(&user->next); | 319 | list_del(&user->next); |
| 319 | kfree(user); | 320 | kfree(user); |
| @@ -321,7 +322,7 @@ void dcookie_unregister(struct dcookie_user * user) | |||
| 321 | if (!is_live()) | 322 | if (!is_live()) |
| 322 | dcookie_exit(); | 323 | dcookie_exit(); |
| 323 | 324 | ||
| 324 | up(&dcookie_sem); | 325 | mutex_unlock(&dcookie_mutex); |
| 325 | } | 326 | } |
| 326 | 327 | ||
| 327 | EXPORT_SYMBOL_GPL(dcookie_register); | 328 | EXPORT_SYMBOL_GPL(dcookie_register); |
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 4db8be8e90cc..5c63e0cdcf4c 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
| @@ -33,13 +33,14 @@ | |||
| 33 | */ | 33 | */ |
| 34 | #define STREAM_END_SPACE 12 | 34 | #define STREAM_END_SPACE 12 |
| 35 | 35 | ||
| 36 | static DECLARE_MUTEX(deflate_sem); | 36 | static DEFINE_MUTEX(deflate_mutex); |
| 37 | static DECLARE_MUTEX(inflate_sem); | 37 | static DEFINE_MUTEX(inflate_mutex); |
| 38 | static z_stream inf_strm, def_strm; | 38 | static z_stream inf_strm, def_strm; |
| 39 | 39 | ||
| 40 | #ifdef __KERNEL__ /* Linux-only */ | 40 | #ifdef __KERNEL__ /* Linux-only */ |
| 41 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
| 42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
| 43 | #include <linux/mutex.h> | ||
| 43 | 44 | ||
| 44 | static int __init alloc_workspaces(void) | 45 | static int __init alloc_workspaces(void) |
| 45 | { | 46 | { |
| @@ -79,11 +80,11 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
| 79 | if (*dstlen <= STREAM_END_SPACE) | 80 | if (*dstlen <= STREAM_END_SPACE) |
| 80 | return -1; | 81 | return -1; |
| 81 | 82 | ||
| 82 | down(&deflate_sem); | 83 | mutex_lock(&deflate_mutex); |
| 83 | 84 | ||
| 84 | if (Z_OK != zlib_deflateInit(&def_strm, 3)) { | 85 | if (Z_OK != zlib_deflateInit(&def_strm, 3)) { |
| 85 | printk(KERN_WARNING "deflateInit failed\n"); | 86 | printk(KERN_WARNING "deflateInit failed\n"); |
| 86 | up(&deflate_sem); | 87 | mutex_unlock(&deflate_mutex); |
| 87 | return -1; | 88 | return -1; |
| 88 | } | 89 | } |
| 89 | 90 | ||
| @@ -104,7 +105,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
| 104 | if (ret != Z_OK) { | 105 | if (ret != Z_OK) { |
| 105 | D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); | 106 | D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); |
| 106 | zlib_deflateEnd(&def_strm); | 107 | zlib_deflateEnd(&def_strm); |
| 107 | up(&deflate_sem); | 108 | mutex_unlock(&deflate_mutex); |
| 108 | return -1; | 109 | return -1; |
| 109 | } | 110 | } |
| 110 | } | 111 | } |
| @@ -133,7 +134,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
| 133 | *sourcelen = def_strm.total_in; | 134 | *sourcelen = def_strm.total_in; |
| 134 | ret = 0; | 135 | ret = 0; |
| 135 | out: | 136 | out: |
| 136 | up(&deflate_sem); | 137 | mutex_unlock(&deflate_mutex); |
| 137 | return ret; | 138 | return ret; |
| 138 | } | 139 | } |
| 139 | 140 | ||
| @@ -145,7 +146,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
| 145 | int ret; | 146 | int ret; |
| 146 | int wbits = MAX_WBITS; | 147 | int wbits = MAX_WBITS; |
| 147 | 148 | ||
| 148 | down(&inflate_sem); | 149 | mutex_lock(&inflate_mutex); |
| 149 | 150 | ||
| 150 | inf_strm.next_in = data_in; | 151 | inf_strm.next_in = data_in; |
| 151 | inf_strm.avail_in = srclen; | 152 | inf_strm.avail_in = srclen; |
| @@ -173,7 +174,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
| 173 | 174 | ||
| 174 | if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { | 175 | if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { |
| 175 | printk(KERN_WARNING "inflateInit failed\n"); | 176 | printk(KERN_WARNING "inflateInit failed\n"); |
| 176 | up(&inflate_sem); | 177 | mutex_unlock(&inflate_mutex); |
| 177 | return 1; | 178 | return 1; |
| 178 | } | 179 | } |
| 179 | 180 | ||
| @@ -183,7 +184,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
| 183 | printk(KERN_NOTICE "inflate returned %d\n", ret); | 184 | printk(KERN_NOTICE "inflate returned %d\n", ret); |
| 184 | } | 185 | } |
| 185 | zlib_inflateEnd(&inf_strm); | 186 | zlib_inflateEnd(&inf_strm); |
| 186 | up(&inflate_sem); | 187 | mutex_unlock(&inflate_mutex); |
| 187 | return 0; | 188 | return 0; |
| 188 | } | 189 | } |
| 189 | 190 | ||
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 0b348b13b551..3315f0b1fbc0 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
| @@ -69,6 +69,7 @@ | |||
| 69 | #include <linux/bio.h> | 69 | #include <linux/bio.h> |
| 70 | #include <linux/suspend.h> | 70 | #include <linux/suspend.h> |
| 71 | #include <linux/delay.h> | 71 | #include <linux/delay.h> |
| 72 | #include <linux/mutex.h> | ||
| 72 | #include "jfs_incore.h" | 73 | #include "jfs_incore.h" |
| 73 | #include "jfs_filsys.h" | 74 | #include "jfs_filsys.h" |
| 74 | #include "jfs_metapage.h" | 75 | #include "jfs_metapage.h" |
| @@ -165,7 +166,7 @@ do { \ | |||
| 165 | */ | 166 | */ |
| 166 | static LIST_HEAD(jfs_external_logs); | 167 | static LIST_HEAD(jfs_external_logs); |
| 167 | static struct jfs_log *dummy_log = NULL; | 168 | static struct jfs_log *dummy_log = NULL; |
| 168 | static DECLARE_MUTEX(jfs_log_sem); | 169 | static DEFINE_MUTEX(jfs_log_mutex); |
| 169 | 170 | ||
| 170 | /* | 171 | /* |
| 171 | * forward references | 172 | * forward references |
| @@ -1085,20 +1086,20 @@ int lmLogOpen(struct super_block *sb) | |||
| 1085 | if (sbi->mntflag & JFS_INLINELOG) | 1086 | if (sbi->mntflag & JFS_INLINELOG) |
| 1086 | return open_inline_log(sb); | 1087 | return open_inline_log(sb); |
| 1087 | 1088 | ||
| 1088 | down(&jfs_log_sem); | 1089 | mutex_lock(&jfs_log_mutex); |
| 1089 | list_for_each_entry(log, &jfs_external_logs, journal_list) { | 1090 | list_for_each_entry(log, &jfs_external_logs, journal_list) { |
| 1090 | if (log->bdev->bd_dev == sbi->logdev) { | 1091 | if (log->bdev->bd_dev == sbi->logdev) { |
| 1091 | if (memcmp(log->uuid, sbi->loguuid, | 1092 | if (memcmp(log->uuid, sbi->loguuid, |
| 1092 | sizeof(log->uuid))) { | 1093 | sizeof(log->uuid))) { |
| 1093 | jfs_warn("wrong uuid on JFS journal\n"); | 1094 | jfs_warn("wrong uuid on JFS journal\n"); |
| 1094 | up(&jfs_log_sem); | 1095 | mutex_unlock(&jfs_log_mutex); |
| 1095 | return -EINVAL; | 1096 | return -EINVAL; |
| 1096 | } | 1097 | } |
| 1097 | /* | 1098 | /* |
| 1098 | * add file system to log active file system list | 1099 | * add file system to log active file system list |
| 1099 | */ | 1100 | */ |
| 1100 | if ((rc = lmLogFileSystem(log, sbi, 1))) { | 1101 | if ((rc = lmLogFileSystem(log, sbi, 1))) { |
| 1101 | up(&jfs_log_sem); | 1102 | mutex_unlock(&jfs_log_mutex); |
| 1102 | return rc; | 1103 | return rc; |
| 1103 | } | 1104 | } |
| 1104 | goto journal_found; | 1105 | goto journal_found; |
| @@ -1106,7 +1107,7 @@ int lmLogOpen(struct super_block *sb) | |||
| 1106 | } | 1107 | } |
| 1107 | 1108 | ||
| 1108 | if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) { | 1109 | if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) { |
| 1109 | up(&jfs_log_sem); | 1110 | mutex_unlock(&jfs_log_mutex); |
| 1110 | return -ENOMEM; | 1111 | return -ENOMEM; |
| 1111 | } | 1112 | } |
| 1112 | INIT_LIST_HEAD(&log->sb_list); | 1113 | INIT_LIST_HEAD(&log->sb_list); |
| @@ -1151,7 +1152,7 @@ journal_found: | |||
| 1151 | sbi->log = log; | 1152 | sbi->log = log; |
| 1152 | LOG_UNLOCK(log); | 1153 | LOG_UNLOCK(log); |
| 1153 | 1154 | ||
| 1154 | up(&jfs_log_sem); | 1155 | mutex_unlock(&jfs_log_mutex); |
| 1155 | return 0; | 1156 | return 0; |
| 1156 | 1157 | ||
| 1157 | /* | 1158 | /* |
| @@ -1168,7 +1169,7 @@ journal_found: | |||
| 1168 | blkdev_put(bdev); | 1169 | blkdev_put(bdev); |
| 1169 | 1170 | ||
| 1170 | free: /* free log descriptor */ | 1171 | free: /* free log descriptor */ |
| 1171 | up(&jfs_log_sem); | 1172 | mutex_unlock(&jfs_log_mutex); |
| 1172 | kfree(log); | 1173 | kfree(log); |
| 1173 | 1174 | ||
| 1174 | jfs_warn("lmLogOpen: exit(%d)", rc); | 1175 | jfs_warn("lmLogOpen: exit(%d)", rc); |
| @@ -1212,11 +1213,11 @@ static int open_dummy_log(struct super_block *sb) | |||
| 1212 | { | 1213 | { |
| 1213 | int rc; | 1214 | int rc; |
| 1214 | 1215 | ||
| 1215 | down(&jfs_log_sem); | 1216 | mutex_lock(&jfs_log_mutex); |
| 1216 | if (!dummy_log) { | 1217 | if (!dummy_log) { |
| 1217 | dummy_log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL); | 1218 | dummy_log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL); |
| 1218 | if (!dummy_log) { | 1219 | if (!dummy_log) { |
| 1219 | up(&jfs_log_sem); | 1220 | mutex_unlock(&jfs_log_mutex); |
| 1220 | return -ENOMEM; | 1221 | return -ENOMEM; |
| 1221 | } | 1222 | } |
| 1222 | INIT_LIST_HEAD(&dummy_log->sb_list); | 1223 | INIT_LIST_HEAD(&dummy_log->sb_list); |
| @@ -1229,7 +1230,7 @@ static int open_dummy_log(struct super_block *sb) | |||
| 1229 | if (rc) { | 1230 | if (rc) { |
| 1230 | kfree(dummy_log); | 1231 | kfree(dummy_log); |
| 1231 | dummy_log = NULL; | 1232 | dummy_log = NULL; |
| 1232 | up(&jfs_log_sem); | 1233 | mutex_unlock(&jfs_log_mutex); |
| 1233 | return rc; | 1234 | return rc; |
| 1234 | } | 1235 | } |
| 1235 | } | 1236 | } |
| @@ -1238,7 +1239,7 @@ static int open_dummy_log(struct super_block *sb) | |||
| 1238 | list_add(&JFS_SBI(sb)->log_list, &dummy_log->sb_list); | 1239 | list_add(&JFS_SBI(sb)->log_list, &dummy_log->sb_list); |
| 1239 | JFS_SBI(sb)->log = dummy_log; | 1240 | JFS_SBI(sb)->log = dummy_log; |
| 1240 | LOG_UNLOCK(dummy_log); | 1241 | LOG_UNLOCK(dummy_log); |
| 1241 | up(&jfs_log_sem); | 1242 | mutex_unlock(&jfs_log_mutex); |
| 1242 | 1243 | ||
| 1243 | return 0; | 1244 | return 0; |
| 1244 | } | 1245 | } |
| @@ -1466,7 +1467,7 @@ int lmLogClose(struct super_block *sb) | |||
| 1466 | 1467 | ||
| 1467 | jfs_info("lmLogClose: log:0x%p", log); | 1468 | jfs_info("lmLogClose: log:0x%p", log); |
| 1468 | 1469 | ||
| 1469 | down(&jfs_log_sem); | 1470 | mutex_lock(&jfs_log_mutex); |
| 1470 | LOG_LOCK(log); | 1471 | LOG_LOCK(log); |
| 1471 | list_del(&sbi->log_list); | 1472 | list_del(&sbi->log_list); |
| 1472 | LOG_UNLOCK(log); | 1473 | LOG_UNLOCK(log); |
| @@ -1516,7 +1517,7 @@ int lmLogClose(struct super_block *sb) | |||
| 1516 | kfree(log); | 1517 | kfree(log); |
| 1517 | 1518 | ||
| 1518 | out: | 1519 | out: |
| 1519 | up(&jfs_log_sem); | 1520 | mutex_unlock(&jfs_log_mutex); |
| 1520 | jfs_info("lmLogClose: exit(%d)", rc); | 1521 | jfs_info("lmLogClose: exit(%d)", rc); |
| 1521 | return rc; | 1522 | return rc; |
| 1522 | } | 1523 | } |
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 112ebf8b8dfe..729ac427d359 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/sunrpc/svc.h> | 16 | #include <linux/sunrpc/svc.h> |
| 17 | #include <linux/lockd/lockd.h> | 17 | #include <linux/lockd/lockd.h> |
| 18 | #include <linux/lockd/sm_inter.h> | 18 | #include <linux/lockd/sm_inter.h> |
| 19 | #include <linux/mutex.h> | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | #define NLMDBG_FACILITY NLMDBG_HOSTCACHE | 22 | #define NLMDBG_FACILITY NLMDBG_HOSTCACHE |
| @@ -30,7 +31,7 @@ | |||
| 30 | static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; | 31 | static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; |
| 31 | static unsigned long next_gc; | 32 | static unsigned long next_gc; |
| 32 | static int nrhosts; | 33 | static int nrhosts; |
| 33 | static DECLARE_MUTEX(nlm_host_sema); | 34 | static DEFINE_MUTEX(nlm_host_mutex); |
| 34 | 35 | ||
| 35 | 36 | ||
| 36 | static void nlm_gc_hosts(void); | 37 | static void nlm_gc_hosts(void); |
| @@ -71,7 +72,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin, | |||
| 71 | hash = NLM_ADDRHASH(sin->sin_addr.s_addr); | 72 | hash = NLM_ADDRHASH(sin->sin_addr.s_addr); |
| 72 | 73 | ||
| 73 | /* Lock hash table */ | 74 | /* Lock hash table */ |
| 74 | down(&nlm_host_sema); | 75 | mutex_lock(&nlm_host_mutex); |
| 75 | 76 | ||
| 76 | if (time_after_eq(jiffies, next_gc)) | 77 | if (time_after_eq(jiffies, next_gc)) |
| 77 | nlm_gc_hosts(); | 78 | nlm_gc_hosts(); |
| @@ -91,7 +92,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin, | |||
| 91 | nlm_hosts[hash] = host; | 92 | nlm_hosts[hash] = host; |
| 92 | } | 93 | } |
| 93 | nlm_get_host(host); | 94 | nlm_get_host(host); |
| 94 | up(&nlm_host_sema); | 95 | mutex_unlock(&nlm_host_mutex); |
| 95 | return host; | 96 | return host; |
| 96 | } | 97 | } |
| 97 | } | 98 | } |
| @@ -130,7 +131,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin, | |||
| 130 | next_gc = 0; | 131 | next_gc = 0; |
| 131 | 132 | ||
| 132 | nohost: | 133 | nohost: |
| 133 | up(&nlm_host_sema); | 134 | mutex_unlock(&nlm_host_mutex); |
| 134 | return host; | 135 | return host; |
| 135 | } | 136 | } |
| 136 | 137 | ||
| @@ -141,19 +142,19 @@ nlm_find_client(void) | |||
| 141 | * and return it | 142 | * and return it |
| 142 | */ | 143 | */ |
| 143 | int hash; | 144 | int hash; |
| 144 | down(&nlm_host_sema); | 145 | mutex_lock(&nlm_host_mutex); |
| 145 | for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) { | 146 | for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) { |
| 146 | struct nlm_host *host, **hp; | 147 | struct nlm_host *host, **hp; |
| 147 | for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) { | 148 | for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) { |
| 148 | if (host->h_server && | 149 | if (host->h_server && |
| 149 | host->h_killed == 0) { | 150 | host->h_killed == 0) { |
| 150 | nlm_get_host(host); | 151 | nlm_get_host(host); |
| 151 | up(&nlm_host_sema); | 152 | mutex_unlock(&nlm_host_mutex); |
| 152 | return host; | 153 | return host; |
| 153 | } | 154 | } |
| 154 | } | 155 | } |
| 155 | } | 156 | } |
| 156 | up(&nlm_host_sema); | 157 | mutex_unlock(&nlm_host_mutex); |
| 157 | return NULL; | 158 | return NULL; |
| 158 | } | 159 | } |
| 159 | 160 | ||
| @@ -265,7 +266,7 @@ nlm_shutdown_hosts(void) | |||
| 265 | int i; | 266 | int i; |
| 266 | 267 | ||
| 267 | dprintk("lockd: shutting down host module\n"); | 268 | dprintk("lockd: shutting down host module\n"); |
| 268 | down(&nlm_host_sema); | 269 | mutex_lock(&nlm_host_mutex); |
| 269 | 270 | ||
| 270 | /* First, make all hosts eligible for gc */ | 271 | /* First, make all hosts eligible for gc */ |
| 271 | dprintk("lockd: nuking all hosts...\n"); | 272 | dprintk("lockd: nuking all hosts...\n"); |
| @@ -276,7 +277,7 @@ nlm_shutdown_hosts(void) | |||
| 276 | 277 | ||
| 277 | /* Then, perform a garbage collection pass */ | 278 | /* Then, perform a garbage collection pass */ |
| 278 | nlm_gc_hosts(); | 279 | nlm_gc_hosts(); |
| 279 | up(&nlm_host_sema); | 280 | mutex_unlock(&nlm_host_mutex); |
| 280 | 281 | ||
| 281 | /* complain if any hosts are left */ | 282 | /* complain if any hosts are left */ |
| 282 | if (nrhosts) { | 283 | if (nrhosts) { |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 5e85bde6c123..fd56c8872f34 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/smp.h> | 26 | #include <linux/smp.h> |
| 27 | #include <linux/smp_lock.h> | 27 | #include <linux/smp_lock.h> |
| 28 | #include <linux/mutex.h> | ||
| 28 | 29 | ||
| 29 | #include <linux/sunrpc/types.h> | 30 | #include <linux/sunrpc/types.h> |
| 30 | #include <linux/sunrpc/stats.h> | 31 | #include <linux/sunrpc/stats.h> |
| @@ -43,13 +44,13 @@ static struct svc_program nlmsvc_program; | |||
| 43 | struct nlmsvc_binding * nlmsvc_ops; | 44 | struct nlmsvc_binding * nlmsvc_ops; |
| 44 | EXPORT_SYMBOL(nlmsvc_ops); | 45 | EXPORT_SYMBOL(nlmsvc_ops); |
| 45 | 46 | ||
| 46 | static DECLARE_MUTEX(nlmsvc_sema); | 47 | static DEFINE_MUTEX(nlmsvc_mutex); |
| 47 | static unsigned int nlmsvc_users; | 48 | static unsigned int nlmsvc_users; |
| 48 | static pid_t nlmsvc_pid; | 49 | static pid_t nlmsvc_pid; |
| 49 | int nlmsvc_grace_period; | 50 | int nlmsvc_grace_period; |
| 50 | unsigned long nlmsvc_timeout; | 51 | unsigned long nlmsvc_timeout; |
| 51 | 52 | ||
| 52 | static DECLARE_MUTEX_LOCKED(lockd_start); | 53 | static DECLARE_COMPLETION(lockd_start_done); |
| 53 | static DECLARE_WAIT_QUEUE_HEAD(lockd_exit); | 54 | static DECLARE_WAIT_QUEUE_HEAD(lockd_exit); |
| 54 | 55 | ||
| 55 | /* | 56 | /* |
| @@ -112,7 +113,7 @@ lockd(struct svc_rqst *rqstp) | |||
| 112 | * Let our maker know we're running. | 113 | * Let our maker know we're running. |
| 113 | */ | 114 | */ |
| 114 | nlmsvc_pid = current->pid; | 115 | nlmsvc_pid = current->pid; |
| 115 | up(&lockd_start); | 116 | complete(&lockd_start_done); |
| 116 | 117 | ||
| 117 | daemonize("lockd"); | 118 | daemonize("lockd"); |
| 118 | 119 | ||
| @@ -215,7 +216,7 @@ lockd_up(void) | |||
| 215 | struct svc_serv * serv; | 216 | struct svc_serv * serv; |
| 216 | int error = 0; | 217 | int error = 0; |
| 217 | 218 | ||
| 218 | down(&nlmsvc_sema); | 219 | mutex_lock(&nlmsvc_mutex); |
| 219 | /* | 220 | /* |
| 220 | * Unconditionally increment the user count ... this is | 221 | * Unconditionally increment the user count ... this is |
| 221 | * the number of clients who _want_ a lockd process. | 222 | * the number of clients who _want_ a lockd process. |
| @@ -263,7 +264,7 @@ lockd_up(void) | |||
| 263 | "lockd_up: create thread failed, error=%d\n", error); | 264 | "lockd_up: create thread failed, error=%d\n", error); |
| 264 | goto destroy_and_out; | 265 | goto destroy_and_out; |
| 265 | } | 266 | } |
| 266 | down(&lockd_start); | 267 | wait_for_completion(&lockd_start_done); |
| 267 | 268 | ||
| 268 | /* | 269 | /* |
| 269 | * Note: svc_serv structures have an initial use count of 1, | 270 | * Note: svc_serv structures have an initial use count of 1, |
| @@ -272,7 +273,7 @@ lockd_up(void) | |||
| 272 | destroy_and_out: | 273 | destroy_and_out: |
| 273 | svc_destroy(serv); | 274 | svc_destroy(serv); |
| 274 | out: | 275 | out: |
| 275 | up(&nlmsvc_sema); | 276 | mutex_unlock(&nlmsvc_mutex); |
| 276 | return error; | 277 | return error; |
| 277 | } | 278 | } |
| 278 | EXPORT_SYMBOL(lockd_up); | 279 | EXPORT_SYMBOL(lockd_up); |
| @@ -285,7 +286,7 @@ lockd_down(void) | |||
| 285 | { | 286 | { |
| 286 | static int warned; | 287 | static int warned; |
| 287 | 288 | ||
| 288 | down(&nlmsvc_sema); | 289 | mutex_lock(&nlmsvc_mutex); |
| 289 | if (nlmsvc_users) { | 290 | if (nlmsvc_users) { |
| 290 | if (--nlmsvc_users) | 291 | if (--nlmsvc_users) |
| 291 | goto out; | 292 | goto out; |
| @@ -315,7 +316,7 @@ lockd_down(void) | |||
| 315 | recalc_sigpending(); | 316 | recalc_sigpending(); |
| 316 | spin_unlock_irq(¤t->sighand->siglock); | 317 | spin_unlock_irq(¤t->sighand->siglock); |
| 317 | out: | 318 | out: |
| 318 | up(&nlmsvc_sema); | 319 | mutex_unlock(&nlmsvc_mutex); |
| 319 | } | 320 | } |
| 320 | EXPORT_SYMBOL(lockd_down); | 321 | EXPORT_SYMBOL(lockd_down); |
| 321 | 322 | ||
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index c7a6e3ae44d6..a570e5c8a930 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
| 12 | #include <linux/time.h> | 12 | #include <linux/time.h> |
| 13 | #include <linux/in.h> | 13 | #include <linux/in.h> |
| 14 | #include <linux/mutex.h> | ||
| 14 | #include <linux/sunrpc/svc.h> | 15 | #include <linux/sunrpc/svc.h> |
| 15 | #include <linux/sunrpc/clnt.h> | 16 | #include <linux/sunrpc/clnt.h> |
| 16 | #include <linux/nfsd/nfsfh.h> | 17 | #include <linux/nfsd/nfsfh.h> |
| @@ -28,7 +29,7 @@ | |||
| 28 | #define FILE_HASH_BITS 5 | 29 | #define FILE_HASH_BITS 5 |
| 29 | #define FILE_NRHASH (1<<FILE_HASH_BITS) | 30 | #define FILE_NRHASH (1<<FILE_HASH_BITS) |
| 30 | static struct nlm_file * nlm_files[FILE_NRHASH]; | 31 | static struct nlm_file * nlm_files[FILE_NRHASH]; |
| 31 | static DECLARE_MUTEX(nlm_file_sema); | 32 | static DEFINE_MUTEX(nlm_file_mutex); |
| 32 | 33 | ||
| 33 | #ifdef NFSD_DEBUG | 34 | #ifdef NFSD_DEBUG |
| 34 | static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) | 35 | static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) |
| @@ -91,7 +92,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, | |||
| 91 | hash = file_hash(f); | 92 | hash = file_hash(f); |
| 92 | 93 | ||
| 93 | /* Lock file table */ | 94 | /* Lock file table */ |
| 94 | down(&nlm_file_sema); | 95 | mutex_lock(&nlm_file_mutex); |
| 95 | 96 | ||
| 96 | for (file = nlm_files[hash]; file; file = file->f_next) | 97 | for (file = nlm_files[hash]; file; file = file->f_next) |
| 97 | if (!nfs_compare_fh(&file->f_handle, f)) | 98 | if (!nfs_compare_fh(&file->f_handle, f)) |
| @@ -130,7 +131,7 @@ found: | |||
| 130 | nfserr = 0; | 131 | nfserr = 0; |
| 131 | 132 | ||
| 132 | out_unlock: | 133 | out_unlock: |
| 133 | up(&nlm_file_sema); | 134 | mutex_unlock(&nlm_file_mutex); |
| 134 | return nfserr; | 135 | return nfserr; |
| 135 | 136 | ||
| 136 | out_free: | 137 | out_free: |
| @@ -239,14 +240,14 @@ nlm_traverse_files(struct nlm_host *host, int action) | |||
| 239 | struct nlm_file *file, **fp; | 240 | struct nlm_file *file, **fp; |
| 240 | int i; | 241 | int i; |
| 241 | 242 | ||
| 242 | down(&nlm_file_sema); | 243 | mutex_lock(&nlm_file_mutex); |
| 243 | for (i = 0; i < FILE_NRHASH; i++) { | 244 | for (i = 0; i < FILE_NRHASH; i++) { |
| 244 | fp = nlm_files + i; | 245 | fp = nlm_files + i; |
| 245 | while ((file = *fp) != NULL) { | 246 | while ((file = *fp) != NULL) { |
| 246 | /* Traverse locks, blocks and shares of this file | 247 | /* Traverse locks, blocks and shares of this file |
| 247 | * and update file->f_locks count */ | 248 | * and update file->f_locks count */ |
| 248 | if (nlm_inspect_file(host, file, action)) { | 249 | if (nlm_inspect_file(host, file, action)) { |
| 249 | up(&nlm_file_sema); | 250 | mutex_unlock(&nlm_file_mutex); |
| 250 | return 1; | 251 | return 1; |
| 251 | } | 252 | } |
| 252 | 253 | ||
| @@ -261,7 +262,7 @@ nlm_traverse_files(struct nlm_host *host, int action) | |||
| 261 | } | 262 | } |
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| 264 | up(&nlm_file_sema); | 265 | mutex_unlock(&nlm_file_mutex); |
| 265 | return 0; | 266 | return 0; |
| 266 | } | 267 | } |
| 267 | 268 | ||
| @@ -281,7 +282,7 @@ nlm_release_file(struct nlm_file *file) | |||
| 281 | file, file->f_count); | 282 | file, file->f_count); |
| 282 | 283 | ||
| 283 | /* Lock file table */ | 284 | /* Lock file table */ |
| 284 | down(&nlm_file_sema); | 285 | mutex_lock(&nlm_file_mutex); |
| 285 | 286 | ||
| 286 | /* If there are no more locks etc, delete the file */ | 287 | /* If there are no more locks etc, delete the file */ |
| 287 | if(--file->f_count == 0) { | 288 | if(--file->f_count == 0) { |
| @@ -289,7 +290,7 @@ nlm_release_file(struct nlm_file *file) | |||
| 289 | nlm_delete_file(file); | 290 | nlm_delete_file(file); |
| 290 | } | 291 | } |
| 291 | 292 | ||
| 292 | up(&nlm_file_sema); | 293 | mutex_unlock(&nlm_file_mutex); |
| 293 | } | 294 | } |
| 294 | 295 | ||
| 295 | /* | 296 | /* |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 99d2cfbce863..90c95adc8c1b 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/sunrpc/svc.h> | 14 | #include <linux/sunrpc/svc.h> |
| 15 | #include <linux/sunrpc/svcsock.h> | 15 | #include <linux/sunrpc/svcsock.h> |
| 16 | #include <linux/nfs_fs.h> | 16 | #include <linux/nfs_fs.h> |
| 17 | #include <linux/mutex.h> | ||
| 17 | 18 | ||
| 18 | #include <net/inet_sock.h> | 19 | #include <net/inet_sock.h> |
| 19 | 20 | ||
| @@ -31,7 +32,7 @@ struct nfs_callback_data { | |||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | static struct nfs_callback_data nfs_callback_info; | 34 | static struct nfs_callback_data nfs_callback_info; |
| 34 | static DECLARE_MUTEX(nfs_callback_sema); | 35 | static DEFINE_MUTEX(nfs_callback_mutex); |
| 35 | static struct svc_program nfs4_callback_program; | 36 | static struct svc_program nfs4_callback_program; |
| 36 | 37 | ||
| 37 | unsigned int nfs_callback_set_tcpport; | 38 | unsigned int nfs_callback_set_tcpport; |
| @@ -95,7 +96,7 @@ int nfs_callback_up(void) | |||
| 95 | int ret = 0; | 96 | int ret = 0; |
| 96 | 97 | ||
| 97 | lock_kernel(); | 98 | lock_kernel(); |
| 98 | down(&nfs_callback_sema); | 99 | mutex_lock(&nfs_callback_mutex); |
| 99 | if (nfs_callback_info.users++ || nfs_callback_info.pid != 0) | 100 | if (nfs_callback_info.users++ || nfs_callback_info.pid != 0) |
| 100 | goto out; | 101 | goto out; |
| 101 | init_completion(&nfs_callback_info.started); | 102 | init_completion(&nfs_callback_info.started); |
| @@ -121,7 +122,7 @@ int nfs_callback_up(void) | |||
| 121 | nfs_callback_info.serv = serv; | 122 | nfs_callback_info.serv = serv; |
| 122 | wait_for_completion(&nfs_callback_info.started); | 123 | wait_for_completion(&nfs_callback_info.started); |
| 123 | out: | 124 | out: |
| 124 | up(&nfs_callback_sema); | 125 | mutex_unlock(&nfs_callback_mutex); |
| 125 | unlock_kernel(); | 126 | unlock_kernel(); |
| 126 | return ret; | 127 | return ret; |
| 127 | out_destroy: | 128 | out_destroy: |
| @@ -139,7 +140,7 @@ int nfs_callback_down(void) | |||
| 139 | int ret = 0; | 140 | int ret = 0; |
| 140 | 141 | ||
| 141 | lock_kernel(); | 142 | lock_kernel(); |
| 142 | down(&nfs_callback_sema); | 143 | mutex_lock(&nfs_callback_mutex); |
| 143 | nfs_callback_info.users--; | 144 | nfs_callback_info.users--; |
| 144 | do { | 145 | do { |
| 145 | if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0) | 146 | if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0) |
| @@ -147,7 +148,7 @@ int nfs_callback_down(void) | |||
| 147 | if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0) | 148 | if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0) |
| 148 | break; | 149 | break; |
| 149 | } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0); | 150 | } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0); |
| 150 | up(&nfs_callback_sema); | 151 | mutex_unlock(&nfs_callback_mutex); |
| 151 | unlock_kernel(); | 152 | unlock_kernel(); |
| 152 | return ret; | 153 | return ret; |
| 153 | } | 154 | } |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f6ab762bea99..c7b87e92f91b 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #include <linux/nfsd/state.h> | 49 | #include <linux/nfsd/state.h> |
| 50 | #include <linux/nfsd/xdr4.h> | 50 | #include <linux/nfsd/xdr4.h> |
| 51 | #include <linux/namei.h> | 51 | #include <linux/namei.h> |
| 52 | #include <linux/mutex.h> | ||
| 52 | 53 | ||
| 53 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 54 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
| 54 | 55 | ||
| @@ -77,11 +78,11 @@ static void nfs4_set_recdir(char *recdir); | |||
| 77 | 78 | ||
| 78 | /* Locking: | 79 | /* Locking: |
| 79 | * | 80 | * |
| 80 | * client_sema: | 81 | * client_mutex: |
| 81 | * protects clientid_hashtbl[], clientstr_hashtbl[], | 82 | * protects clientid_hashtbl[], clientstr_hashtbl[], |
| 82 | * unconfstr_hashtbl[], uncofid_hashtbl[]. | 83 | * unconfstr_hashtbl[], uncofid_hashtbl[]. |
| 83 | */ | 84 | */ |
| 84 | static DECLARE_MUTEX(client_sema); | 85 | static DEFINE_MUTEX(client_mutex); |
| 85 | 86 | ||
| 86 | static kmem_cache_t *stateowner_slab = NULL; | 87 | static kmem_cache_t *stateowner_slab = NULL; |
| 87 | static kmem_cache_t *file_slab = NULL; | 88 | static kmem_cache_t *file_slab = NULL; |
| @@ -91,13 +92,13 @@ static kmem_cache_t *deleg_slab = NULL; | |||
| 91 | void | 92 | void |
| 92 | nfs4_lock_state(void) | 93 | nfs4_lock_state(void) |
| 93 | { | 94 | { |
| 94 | down(&client_sema); | 95 | mutex_lock(&client_mutex); |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | void | 98 | void |
| 98 | nfs4_unlock_state(void) | 99 | nfs4_unlock_state(void) |
| 99 | { | 100 | { |
| 100 | up(&client_sema); | 101 | mutex_unlock(&client_mutex); |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | static inline u32 | 104 | static inline u32 |
diff --git a/fs/partitions/devfs.c b/fs/partitions/devfs.c index 87f50444fd39..3f0a780c9cec 100644 --- a/fs/partitions/devfs.c +++ b/fs/partitions/devfs.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <linux/vmalloc.h> | 6 | #include <linux/vmalloc.h> |
| 7 | #include <linux/genhd.h> | 7 | #include <linux/genhd.h> |
| 8 | #include <linux/bitops.h> | 8 | #include <linux/bitops.h> |
| 9 | #include <asm/semaphore.h> | 9 | #include <linux/mutex.h> |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | struct unique_numspace { | 12 | struct unique_numspace { |
| @@ -16,7 +16,7 @@ struct unique_numspace { | |||
| 16 | struct semaphore mutex; | 16 | struct semaphore mutex; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | static DECLARE_MUTEX(numspace_mutex); | 19 | static DEFINE_MUTEX(numspace_mutex); |
| 20 | 20 | ||
| 21 | static int expand_numspace(struct unique_numspace *s) | 21 | static int expand_numspace(struct unique_numspace *s) |
| 22 | { | 22 | { |
| @@ -48,7 +48,7 @@ static int alloc_unique_number(struct unique_numspace *s) | |||
| 48 | { | 48 | { |
| 49 | int rval = 0; | 49 | int rval = 0; |
| 50 | 50 | ||
| 51 | down(&numspace_mutex); | 51 | mutex_lock(&numspace_mutex); |
| 52 | if (s->num_free < 1) | 52 | if (s->num_free < 1) |
| 53 | rval = expand_numspace(s); | 53 | rval = expand_numspace(s); |
| 54 | if (!rval) { | 54 | if (!rval) { |
| @@ -56,7 +56,7 @@ static int alloc_unique_number(struct unique_numspace *s) | |||
| 56 | --s->num_free; | 56 | --s->num_free; |
| 57 | __set_bit(rval, s->bits); | 57 | __set_bit(rval, s->bits); |
| 58 | } | 58 | } |
| 59 | up(&numspace_mutex); | 59 | mutex_unlock(&numspace_mutex); |
| 60 | 60 | ||
| 61 | return rval; | 61 | return rval; |
| 62 | } | 62 | } |
| @@ -66,11 +66,11 @@ static void dealloc_unique_number(struct unique_numspace *s, int number) | |||
| 66 | int old_val; | 66 | int old_val; |
| 67 | 67 | ||
| 68 | if (number >= 0) { | 68 | if (number >= 0) { |
| 69 | down(&numspace_mutex); | 69 | mutex_lock(&numspace_mutex); |
| 70 | old_val = __test_and_clear_bit(number, s->bits); | 70 | old_val = __test_and_clear_bit(number, s->bits); |
| 71 | if (old_val) | 71 | if (old_val) |
| 72 | ++s->num_free; | 72 | ++s->num_free; |
| 73 | up(&numspace_mutex); | 73 | mutex_unlock(&numspace_mutex); |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
diff --git a/fs/super.c b/fs/super.c index 8743e9bbb297..a66f66bb8049 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/writeback.h> /* for the emergency remount stuff */ | 37 | #include <linux/writeback.h> /* for the emergency remount stuff */ |
| 38 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
| 39 | #include <linux/kobject.h> | 39 | #include <linux/kobject.h> |
| 40 | #include <linux/mutex.h> | ||
| 40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
| 41 | 42 | ||
| 42 | 43 | ||
| @@ -380,9 +381,9 @@ restart: | |||
| 380 | void sync_filesystems(int wait) | 381 | void sync_filesystems(int wait) |
| 381 | { | 382 | { |
| 382 | struct super_block *sb; | 383 | struct super_block *sb; |
| 383 | static DECLARE_MUTEX(mutex); | 384 | static DEFINE_MUTEX(mutex); |
| 384 | 385 | ||
| 385 | down(&mutex); /* Could be down_interruptible */ | 386 | mutex_lock(&mutex); /* Could be down_interruptible */ |
| 386 | spin_lock(&sb_lock); | 387 | spin_lock(&sb_lock); |
| 387 | list_for_each_entry(sb, &super_blocks, s_list) { | 388 | list_for_each_entry(sb, &super_blocks, s_list) { |
| 388 | if (!sb->s_op->sync_fs) | 389 | if (!sb->s_op->sync_fs) |
| @@ -411,7 +412,7 @@ restart: | |||
| 411 | goto restart; | 412 | goto restart; |
| 412 | } | 413 | } |
| 413 | spin_unlock(&sb_lock); | 414 | spin_unlock(&sb_lock); |
| 414 | up(&mutex); | 415 | mutex_unlock(&mutex); |
| 415 | } | 416 | } |
| 416 | 417 | ||
| 417 | /** | 418 | /** |
