aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jfs/acl.c4
-rw-r--r--fs/jfs/inode.c14
-rw-r--r--fs/jfs/jfs_dmap.c6
-rw-r--r--fs/jfs/jfs_dmap.h2
-rw-r--r--fs/jfs/jfs_extent.c20
-rw-r--r--fs/jfs/jfs_imap.c22
-rw-r--r--fs/jfs/jfs_imap.h4
-rw-r--r--fs/jfs/jfs_incore.h5
-rw-r--r--fs/jfs/jfs_lock.h1
-rw-r--r--fs/jfs/jfs_logmgr.c6
-rw-r--r--fs/jfs/jfs_logmgr.h2
-rw-r--r--fs/jfs/jfs_txnmgr.c10
-rw-r--r--fs/jfs/namei.c98
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/jfs/xattr.c8
15 files changed, 103 insertions, 101 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 461e4934ca7c..e0b6fdab200c 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -207,12 +207,12 @@ static int jfs_acl_chmod(struct inode *inode)
207 rc = posix_acl_chmod_masq(clone, inode->i_mode); 207 rc = posix_acl_chmod_masq(clone, inode->i_mode);
208 if (!rc) { 208 if (!rc) {
209 tid_t tid = txBegin(inode->i_sb, 0); 209 tid_t tid = txBegin(inode->i_sb, 0);
210 down(&JFS_IP(inode)->commit_sem); 210 mutex_lock(&JFS_IP(inode)->commit_mutex);
211 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone); 211 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
212 if (!rc) 212 if (!rc)
213 rc = txCommit(tid, 1, &inode, 0); 213 rc = txCommit(tid, 1, &inode, 0);
214 txEnd(tid); 214 txEnd(tid);
215 up(&JFS_IP(inode)->commit_sem); 215 mutex_unlock(&JFS_IP(inode)->commit_mutex);
216 } 216 }
217 217
218 posix_acl_release(clone); 218 posix_acl_release(clone);
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 9f942ca8e4e3..d7834a9117ce 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -89,16 +89,16 @@ int jfs_commit_inode(struct inode *inode, int wait)
89 } 89 }
90 90
91 tid = txBegin(inode->i_sb, COMMIT_INODE); 91 tid = txBegin(inode->i_sb, COMMIT_INODE);
92 down(&JFS_IP(inode)->commit_sem); 92 mutex_lock(&JFS_IP(inode)->commit_mutex);
93 93
94 /* 94 /*
95 * Retest inode state after taking commit_sem 95 * Retest inode state after taking commit_mutex
96 */ 96 */
97 if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) 97 if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode))
98 rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); 98 rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);
99 99
100 txEnd(tid); 100 txEnd(tid);
101 up(&JFS_IP(inode)->commit_sem); 101 mutex_unlock(&JFS_IP(inode)->commit_mutex);
102 return rc; 102 return rc;
103} 103}
104 104
@@ -335,18 +335,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
335 tid = txBegin(ip->i_sb, 0); 335 tid = txBegin(ip->i_sb, 0);
336 336
337 /* 337 /*
338 * The commit_sem cannot be taken before txBegin. 338 * The commit_mutex cannot be taken before txBegin.
339 * txBegin may block and there is a chance the inode 339 * txBegin may block and there is a chance the inode
340 * could be marked dirty and need to be committed 340 * could be marked dirty and need to be committed
341 * before txBegin unblocks 341 * before txBegin unblocks
342 */ 342 */
343 down(&JFS_IP(ip)->commit_sem); 343 mutex_lock(&JFS_IP(ip)->commit_mutex);
344 344
345 newsize = xtTruncate(tid, ip, length, 345 newsize = xtTruncate(tid, ip, length,
346 COMMIT_TRUNCATE | COMMIT_PWMAP); 346 COMMIT_TRUNCATE | COMMIT_PWMAP);
347 if (newsize < 0) { 347 if (newsize < 0) {
348 txEnd(tid); 348 txEnd(tid);
349 up(&JFS_IP(ip)->commit_sem); 349 mutex_unlock(&JFS_IP(ip)->commit_mutex);
350 break; 350 break;
351 } 351 }
352 352
@@ -355,7 +355,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
355 355
356 txCommit(tid, 1, &ip, 0); 356 txCommit(tid, 1, &ip, 0);
357 txEnd(tid); 357 txEnd(tid);
358 up(&JFS_IP(ip)->commit_sem); 358 mutex_unlock(&JFS_IP(ip)->commit_mutex);
359 } while (newsize > length); /* Truncate isn't always atomic */ 359 } while (newsize > length); /* Truncate isn't always atomic */
360} 360}
361 361
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 038d8b76d113..4fb3ed184925 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -64,9 +64,9 @@
64 * to the persistent bitmaps in dmaps) is guarded by (busy) buffers. 64 * to the persistent bitmaps in dmaps) is guarded by (busy) buffers.
65 */ 65 */
66 66
67#define BMAP_LOCK_INIT(bmp) init_MUTEX(&bmp->db_bmaplock) 67#define BMAP_LOCK_INIT(bmp) mutex_init(&bmp->db_bmaplock)
68#define BMAP_LOCK(bmp) down(&bmp->db_bmaplock) 68#define BMAP_LOCK(bmp) mutex_lock(&bmp->db_bmaplock)
69#define BMAP_UNLOCK(bmp) up(&bmp->db_bmaplock) 69#define BMAP_UNLOCK(bmp) mutex_unlock(&bmp->db_bmaplock)
70 70
71/* 71/*
72 * forward references 72 * forward references
diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h
index 32e25884e7e8..8b14cc8e0228 100644
--- a/fs/jfs/jfs_dmap.h
+++ b/fs/jfs/jfs_dmap.h
@@ -243,7 +243,7 @@ struct dbmap {
243struct bmap { 243struct bmap {
244 struct dbmap db_bmap; /* on-disk aggregate map descriptor */ 244 struct dbmap db_bmap; /* on-disk aggregate map descriptor */
245 struct inode *db_ipbmap; /* ptr to aggregate map incore inode */ 245 struct inode *db_ipbmap; /* ptr to aggregate map incore inode */
246 struct semaphore db_bmaplock; /* aggregate map lock */ 246 struct mutex db_bmaplock; /* aggregate map lock */
247 atomic_t db_active[MAXAG]; /* count of active, open files in AG */ 247 atomic_t db_active[MAXAG]; /* count of active, open files in AG */
248 u32 *db_DBmap; 248 u32 *db_DBmap;
249}; 249};
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 4879603daa1c..5549378358bf 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -94,7 +94,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
94 txBeginAnon(ip->i_sb); 94 txBeginAnon(ip->i_sb);
95 95
96 /* Avoid race with jfs_commit_inode() */ 96 /* Avoid race with jfs_commit_inode() */
97 down(&JFS_IP(ip)->commit_sem); 97 mutex_lock(&JFS_IP(ip)->commit_mutex);
98 98
99 /* validate extent length */ 99 /* validate extent length */
100 if (xlen > MAXXLEN) 100 if (xlen > MAXXLEN)
@@ -136,14 +136,14 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
136 */ 136 */
137 nxlen = xlen; 137 nxlen = xlen;
138 if ((rc = extBalloc(ip, hint ? hint : INOHINT(ip), &nxlen, &nxaddr))) { 138 if ((rc = extBalloc(ip, hint ? hint : INOHINT(ip), &nxlen, &nxaddr))) {
139 up(&JFS_IP(ip)->commit_sem); 139 mutex_unlock(&JFS_IP(ip)->commit_mutex);
140 return (rc); 140 return (rc);
141 } 141 }
142 142
143 /* Allocate blocks to quota. */ 143 /* Allocate blocks to quota. */
144 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { 144 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
145 dbFree(ip, nxaddr, (s64) nxlen); 145 dbFree(ip, nxaddr, (s64) nxlen);
146 up(&JFS_IP(ip)->commit_sem); 146 mutex_unlock(&JFS_IP(ip)->commit_mutex);
147 return -EDQUOT; 147 return -EDQUOT;
148 } 148 }
149 149
@@ -165,7 +165,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
165 if (rc) { 165 if (rc) {
166 dbFree(ip, nxaddr, nxlen); 166 dbFree(ip, nxaddr, nxlen);
167 DQUOT_FREE_BLOCK(ip, nxlen); 167 DQUOT_FREE_BLOCK(ip, nxlen);
168 up(&JFS_IP(ip)->commit_sem); 168 mutex_unlock(&JFS_IP(ip)->commit_mutex);
169 return (rc); 169 return (rc);
170 } 170 }
171 171
@@ -177,7 +177,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
177 177
178 mark_inode_dirty(ip); 178 mark_inode_dirty(ip);
179 179
180 up(&JFS_IP(ip)->commit_sem); 180 mutex_unlock(&JFS_IP(ip)->commit_mutex);
181 /* 181 /*
182 * COMMIT_SyncList flags an anonymous tlock on page that is on 182 * COMMIT_SyncList flags an anonymous tlock on page that is on
183 * sync list. 183 * sync list.
@@ -222,7 +222,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
222 /* This blocks if we are low on resources */ 222 /* This blocks if we are low on resources */
223 txBeginAnon(ip->i_sb); 223 txBeginAnon(ip->i_sb);
224 224
225 down(&JFS_IP(ip)->commit_sem); 225 mutex_lock(&JFS_IP(ip)->commit_mutex);
226 /* validate extent length */ 226 /* validate extent length */
227 if (nxlen > MAXXLEN) 227 if (nxlen > MAXXLEN)
228 nxlen = MAXXLEN; 228 nxlen = MAXXLEN;
@@ -258,7 +258,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
258 /* Allocat blocks to quota. */ 258 /* Allocat blocks to quota. */
259 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { 259 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
260 dbFree(ip, nxaddr, (s64) nxlen); 260 dbFree(ip, nxaddr, (s64) nxlen);
261 up(&JFS_IP(ip)->commit_sem); 261 mutex_unlock(&JFS_IP(ip)->commit_mutex);
262 return -EDQUOT; 262 return -EDQUOT;
263 } 263 }
264 264
@@ -338,7 +338,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
338 338
339 mark_inode_dirty(ip); 339 mark_inode_dirty(ip);
340exit: 340exit:
341 up(&JFS_IP(ip)->commit_sem); 341 mutex_unlock(&JFS_IP(ip)->commit_mutex);
342 return (rc); 342 return (rc);
343} 343}
344#endif /* _NOTYET */ 344#endif /* _NOTYET */
@@ -439,12 +439,12 @@ int extRecord(struct inode *ip, xad_t * xp)
439 439
440 txBeginAnon(ip->i_sb); 440 txBeginAnon(ip->i_sb);
441 441
442 down(&JFS_IP(ip)->commit_sem); 442 mutex_lock(&JFS_IP(ip)->commit_mutex);
443 443
444 /* update the extent */ 444 /* update the extent */
445 rc = xtUpdate(0, ip, xp); 445 rc = xtUpdate(0, ip, xp);
446 446
447 up(&JFS_IP(ip)->commit_sem); 447 mutex_unlock(&JFS_IP(ip)->commit_mutex);
448 return rc; 448 return rc;
449} 449}
450 450
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 31b4aa13dd4b..87dd86c34c22 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -66,14 +66,14 @@ static HLIST_HEAD(aggregate_hash);
66 * imap locks 66 * imap locks
67 */ 67 */
68/* iag free list lock */ 68/* iag free list lock */
69#define IAGFREE_LOCK_INIT(imap) init_MUTEX(&imap->im_freelock) 69#define IAGFREE_LOCK_INIT(imap) mutex_init(&imap->im_freelock)
70#define IAGFREE_LOCK(imap) down(&imap->im_freelock) 70#define IAGFREE_LOCK(imap) mutex_lock(&imap->im_freelock)
71#define IAGFREE_UNLOCK(imap) up(&imap->im_freelock) 71#define IAGFREE_UNLOCK(imap) mutex_unlock(&imap->im_freelock)
72 72
73/* per ag iag list locks */ 73/* per ag iag list locks */
74#define AG_LOCK_INIT(imap,index) init_MUTEX(&(imap->im_aglock[index])) 74#define AG_LOCK_INIT(imap,index) mutex_init(&(imap->im_aglock[index]))
75#define AG_LOCK(imap,agno) down(&imap->im_aglock[agno]) 75#define AG_LOCK(imap,agno) mutex_lock(&imap->im_aglock[agno])
76#define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) 76#define AG_UNLOCK(imap,agno) mutex_unlock(&imap->im_aglock[agno])
77 77
78/* 78/*
79 * forward references 79 * forward references
@@ -1261,7 +1261,7 @@ int diFree(struct inode *ip)
1261 * to be freed by the transaction; 1261 * to be freed by the transaction;
1262 */ 1262 */
1263 tid = txBegin(ipimap->i_sb, COMMIT_FORCE); 1263 tid = txBegin(ipimap->i_sb, COMMIT_FORCE);
1264 down(&JFS_IP(ipimap)->commit_sem); 1264 mutex_lock(&JFS_IP(ipimap)->commit_mutex);
1265 1265
1266 /* acquire tlock of the iag page of the freed ixad 1266 /* acquire tlock of the iag page of the freed ixad
1267 * to force the page NOHOMEOK (even though no data is 1267 * to force the page NOHOMEOK (even though no data is
@@ -1294,7 +1294,7 @@ int diFree(struct inode *ip)
1294 rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); 1294 rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE);
1295 1295
1296 txEnd(tid); 1296 txEnd(tid);
1297 up(&JFS_IP(ipimap)->commit_sem); 1297 mutex_unlock(&JFS_IP(ipimap)->commit_mutex);
1298 1298
1299 /* unlock the AG inode map information */ 1299 /* unlock the AG inode map information */
1300 AG_UNLOCK(imap, agno); 1300 AG_UNLOCK(imap, agno);
@@ -2554,13 +2554,13 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2554 * addressing structure pointing to the new iag page; 2554 * addressing structure pointing to the new iag page;
2555 */ 2555 */
2556 tid = txBegin(sb, COMMIT_FORCE); 2556 tid = txBegin(sb, COMMIT_FORCE);
2557 down(&JFS_IP(ipimap)->commit_sem); 2557 mutex_lock(&JFS_IP(ipimap)->commit_mutex);
2558 2558
2559 /* update the inode map addressing structure to point to it */ 2559 /* update the inode map addressing structure to point to it */
2560 if ((rc = 2560 if ((rc =
2561 xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { 2561 xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) {
2562 txEnd(tid); 2562 txEnd(tid);
2563 up(&JFS_IP(ipimap)->commit_sem); 2563 mutex_unlock(&JFS_IP(ipimap)->commit_mutex);
2564 /* Free the blocks allocated for the iag since it was 2564 /* Free the blocks allocated for the iag since it was
2565 * not successfully added to the inode map 2565 * not successfully added to the inode map
2566 */ 2566 */
@@ -2626,7 +2626,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2626 rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); 2626 rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE);
2627 2627
2628 txEnd(tid); 2628 txEnd(tid);
2629 up(&JFS_IP(ipimap)->commit_sem); 2629 mutex_unlock(&JFS_IP(ipimap)->commit_mutex);
2630 2630
2631 duplicateIXtree(sb, blkno, xlen, &xaddr); 2631 duplicateIXtree(sb, blkno, xlen, &xaddr);
2632 2632
diff --git a/fs/jfs/jfs_imap.h b/fs/jfs/jfs_imap.h
index 6b59adec036a..6e24465f0f98 100644
--- a/fs/jfs/jfs_imap.h
+++ b/fs/jfs/jfs_imap.h
@@ -140,8 +140,8 @@ struct dinomap {
140struct inomap { 140struct inomap {
141 struct dinomap im_imap; /* 4096: inode allocation control */ 141 struct dinomap im_imap; /* 4096: inode allocation control */
142 struct inode *im_ipimap; /* 4: ptr to inode for imap */ 142 struct inode *im_ipimap; /* 4: ptr to inode for imap */
143 struct semaphore im_freelock; /* 4: iag free list lock */ 143 struct mutex im_freelock; /* 4: iag free list lock */
144 struct semaphore im_aglock[MAXAG]; /* 512: per AG locks */ 144 struct mutex im_aglock[MAXAG]; /* 512: per AG locks */
145 u32 *im_DBGdimap; 145 u32 *im_DBGdimap;
146 atomic_t im_numinos; /* num of backed inodes */ 146 atomic_t im_numinos; /* num of backed inodes */
147 atomic_t im_numfree; /* num of free backed inodes */ 147 atomic_t im_numfree; /* num of free backed inodes */
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index dc21a5bd54d4..a97ead889a68 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -19,6 +19,7 @@
19#ifndef _H_JFS_INCORE 19#ifndef _H_JFS_INCORE
20#define _H_JFS_INCORE 20#define _H_JFS_INCORE
21 21
22#include <linux/mutex.h>
22#include <linux/rwsem.h> 23#include <linux/rwsem.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/bitops.h> 25#include <linux/bitops.h>
@@ -62,12 +63,12 @@ struct jfs_inode_info {
62 */ 63 */
63 struct rw_semaphore rdwrlock; 64 struct rw_semaphore rdwrlock;
64 /* 65 /*
65 * commit_sem serializes transaction processing on an inode. 66 * commit_mutex serializes transaction processing on an inode.
66 * It must be taken after beginning a transaction (txBegin), since 67 * It must be taken after beginning a transaction (txBegin), since
67 * dirty inodes may be committed while a new transaction on the 68 * dirty inodes may be committed while a new transaction on the
68 * inode is blocked in txBegin or TxBeginAnon 69 * inode is blocked in txBegin or TxBeginAnon
69 */ 70 */
70 struct semaphore commit_sem; 71 struct mutex commit_mutex;
71 /* xattr_sem allows us to access the xattrs without taking i_mutex */ 72 /* xattr_sem allows us to access the xattrs without taking i_mutex */
72 struct rw_semaphore xattr_sem; 73 struct rw_semaphore xattr_sem;
73 lid_t xtlid; /* lid of xtree lock on directory */ 74 lid_t xtlid; /* lid of xtree lock on directory */
diff --git a/fs/jfs/jfs_lock.h b/fs/jfs/jfs_lock.h
index 10ad1d086685..70ac9f7d1e00 100644
--- a/fs/jfs/jfs_lock.h
+++ b/fs/jfs/jfs_lock.h
@@ -20,6 +20,7 @@
20#define _H_JFS_LOCK 20#define _H_JFS_LOCK
21 21
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/mutex.h>
23#include <linux/sched.h> 24#include <linux/sched.h>
24 25
25/* 26/*
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index d27bac6acaa3..06bded6c12b9 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -87,9 +87,9 @@ DECLARE_WAIT_QUEUE_HEAD(jfs_IO_thread_wait);
87/* 87/*
88 * log read/write serialization (per log) 88 * log read/write serialization (per log)
89 */ 89 */
90#define LOG_LOCK_INIT(log) init_MUTEX(&(log)->loglock) 90#define LOG_LOCK_INIT(log) mutex_init(&(log)->loglock)
91#define LOG_LOCK(log) down(&((log)->loglock)) 91#define LOG_LOCK(log) mutex_lock(&((log)->loglock))
92#define LOG_UNLOCK(log) up(&((log)->loglock)) 92#define LOG_UNLOCK(log) mutex_unlock(&((log)->loglock))
93 93
94 94
95/* 95/*
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
index e4978b5b65ee..8c6909b80014 100644
--- a/fs/jfs/jfs_logmgr.h
+++ b/fs/jfs/jfs_logmgr.h
@@ -389,7 +389,7 @@ struct jfs_log {
389 int eor; /* 4: eor of last record in eol page */ 389 int eor; /* 4: eor of last record in eol page */
390 struct lbuf *bp; /* 4: current log page buffer */ 390 struct lbuf *bp; /* 4: current log page buffer */
391 391
392 struct semaphore loglock; /* 4: log write serialization lock */ 392 struct mutex loglock; /* 4: log write serialization lock */
393 393
394 /* syncpt */ 394 /* syncpt */
395 int nextsync; /* 4: bytes to write before next syncpt */ 395 int nextsync; /* 4: bytes to write before next syncpt */
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 2ddb6b892bcf..d38f605d9481 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -2876,10 +2876,10 @@ restart:
2876 */ 2876 */
2877 TXN_UNLOCK(); 2877 TXN_UNLOCK();
2878 tid = txBegin(ip->i_sb, COMMIT_INODE | COMMIT_FORCE); 2878 tid = txBegin(ip->i_sb, COMMIT_INODE | COMMIT_FORCE);
2879 down(&jfs_ip->commit_sem); 2879 mutex_lock(&jfs_ip->commit_mutex);
2880 txCommit(tid, 1, &ip, 0); 2880 txCommit(tid, 1, &ip, 0);
2881 txEnd(tid); 2881 txEnd(tid);
2882 up(&jfs_ip->commit_sem); 2882 mutex_unlock(&jfs_ip->commit_mutex);
2883 /* 2883 /*
2884 * Just to be safe. I don't know how 2884 * Just to be safe. I don't know how
2885 * long we can run without blocking 2885 * long we can run without blocking
@@ -2952,7 +2952,7 @@ int jfs_sync(void *arg)
2952 * Inode is being freed 2952 * Inode is being freed
2953 */ 2953 */
2954 list_del_init(&jfs_ip->anon_inode_list); 2954 list_del_init(&jfs_ip->anon_inode_list);
2955 } else if (! down_trylock(&jfs_ip->commit_sem)) { 2955 } else if (! !mutex_trylock(&jfs_ip->commit_mutex)) {
2956 /* 2956 /*
2957 * inode will be removed from anonymous list 2957 * inode will be removed from anonymous list
2958 * when it is committed 2958 * when it is committed
@@ -2961,7 +2961,7 @@ int jfs_sync(void *arg)
2961 tid = txBegin(ip->i_sb, COMMIT_INODE); 2961 tid = txBegin(ip->i_sb, COMMIT_INODE);
2962 rc = txCommit(tid, 1, &ip, 0); 2962 rc = txCommit(tid, 1, &ip, 0);
2963 txEnd(tid); 2963 txEnd(tid);
2964 up(&jfs_ip->commit_sem); 2964 mutex_unlock(&jfs_ip->commit_mutex);
2965 2965
2966 iput(ip); 2966 iput(ip);
2967 /* 2967 /*
@@ -2971,7 +2971,7 @@ int jfs_sync(void *arg)
2971 cond_resched(); 2971 cond_resched();
2972 TXN_LOCK(); 2972 TXN_LOCK();
2973 } else { 2973 } else {
2974 /* We can't get the commit semaphore. It may 2974 /* We can't get the commit mutex. It may
2975 * be held by a thread waiting for tlock's 2975 * be held by a thread waiting for tlock's
2976 * so let's not block here. Save it to 2976 * so let's not block here. Save it to
2977 * put back on the anon_list. 2977 * put back on the anon_list.
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 4abbe8604302..ed4d170c212d 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -104,8 +104,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
104 104
105 tid = txBegin(dip->i_sb, 0); 105 tid = txBegin(dip->i_sb, 0);
106 106
107 down(&JFS_IP(dip)->commit_sem); 107 mutex_lock(&JFS_IP(dip)->commit_mutex);
108 down(&JFS_IP(ip)->commit_sem); 108 mutex_lock(&JFS_IP(ip)->commit_mutex);
109 109
110 rc = jfs_init_acl(tid, ip, dip); 110 rc = jfs_init_acl(tid, ip, dip);
111 if (rc) 111 if (rc)
@@ -165,8 +165,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
165 165
166 out3: 166 out3:
167 txEnd(tid); 167 txEnd(tid);
168 up(&JFS_IP(dip)->commit_sem); 168 mutex_unlock(&JFS_IP(dip)->commit_mutex);
169 up(&JFS_IP(ip)->commit_sem); 169 mutex_unlock(&JFS_IP(ip)->commit_mutex);
170 if (rc) { 170 if (rc) {
171 free_ea_wmap(ip); 171 free_ea_wmap(ip);
172 ip->i_nlink = 0; 172 ip->i_nlink = 0;
@@ -238,8 +238,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
238 238
239 tid = txBegin(dip->i_sb, 0); 239 tid = txBegin(dip->i_sb, 0);
240 240
241 down(&JFS_IP(dip)->commit_sem); 241 mutex_lock(&JFS_IP(dip)->commit_mutex);
242 down(&JFS_IP(ip)->commit_sem); 242 mutex_lock(&JFS_IP(ip)->commit_mutex);
243 243
244 rc = jfs_init_acl(tid, ip, dip); 244 rc = jfs_init_acl(tid, ip, dip);
245 if (rc) 245 if (rc)
@@ -300,8 +300,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
300 300
301 out3: 301 out3:
302 txEnd(tid); 302 txEnd(tid);
303 up(&JFS_IP(dip)->commit_sem); 303 mutex_unlock(&JFS_IP(dip)->commit_mutex);
304 up(&JFS_IP(ip)->commit_sem); 304 mutex_unlock(&JFS_IP(ip)->commit_mutex);
305 if (rc) { 305 if (rc) {
306 free_ea_wmap(ip); 306 free_ea_wmap(ip);
307 ip->i_nlink = 0; 307 ip->i_nlink = 0;
@@ -365,8 +365,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
365 365
366 tid = txBegin(dip->i_sb, 0); 366 tid = txBegin(dip->i_sb, 0);
367 367
368 down(&JFS_IP(dip)->commit_sem); 368 mutex_lock(&JFS_IP(dip)->commit_mutex);
369 down(&JFS_IP(ip)->commit_sem); 369 mutex_lock(&JFS_IP(ip)->commit_mutex);
370 370
371 iplist[0] = dip; 371 iplist[0] = dip;
372 iplist[1] = ip; 372 iplist[1] = ip;
@@ -384,8 +384,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
384 if (rc == -EIO) 384 if (rc == -EIO)
385 txAbort(tid, 1); 385 txAbort(tid, 1);
386 txEnd(tid); 386 txEnd(tid);
387 up(&JFS_IP(dip)->commit_sem); 387 mutex_unlock(&JFS_IP(dip)->commit_mutex);
388 up(&JFS_IP(ip)->commit_sem); 388 mutex_unlock(&JFS_IP(ip)->commit_mutex);
389 389
390 goto out2; 390 goto out2;
391 } 391 }
@@ -422,8 +422,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
422 422
423 txEnd(tid); 423 txEnd(tid);
424 424
425 up(&JFS_IP(dip)->commit_sem); 425 mutex_unlock(&JFS_IP(dip)->commit_mutex);
426 up(&JFS_IP(ip)->commit_sem); 426 mutex_unlock(&JFS_IP(ip)->commit_mutex);
427 427
428 /* 428 /*
429 * Truncating the directory index table is not guaranteed. It 429 * Truncating the directory index table is not guaranteed. It
@@ -488,8 +488,8 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
488 488
489 tid = txBegin(dip->i_sb, 0); 489 tid = txBegin(dip->i_sb, 0);
490 490
491 down(&JFS_IP(dip)->commit_sem); 491 mutex_lock(&JFS_IP(dip)->commit_mutex);
492 down(&JFS_IP(ip)->commit_sem); 492 mutex_lock(&JFS_IP(ip)->commit_mutex);
493 493
494 iplist[0] = dip; 494 iplist[0] = dip;
495 iplist[1] = ip; 495 iplist[1] = ip;
@@ -503,8 +503,8 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
503 if (rc == -EIO) 503 if (rc == -EIO)
504 txAbort(tid, 1); /* Marks FS Dirty */ 504 txAbort(tid, 1); /* Marks FS Dirty */
505 txEnd(tid); 505 txEnd(tid);
506 up(&JFS_IP(dip)->commit_sem); 506 mutex_unlock(&JFS_IP(dip)->commit_mutex);
507 up(&JFS_IP(ip)->commit_sem); 507 mutex_unlock(&JFS_IP(ip)->commit_mutex);
508 IWRITE_UNLOCK(ip); 508 IWRITE_UNLOCK(ip);
509 goto out1; 509 goto out1;
510 } 510 }
@@ -527,8 +527,8 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
527 if ((new_size = commitZeroLink(tid, ip)) < 0) { 527 if ((new_size = commitZeroLink(tid, ip)) < 0) {
528 txAbort(tid, 1); /* Marks FS Dirty */ 528 txAbort(tid, 1); /* Marks FS Dirty */
529 txEnd(tid); 529 txEnd(tid);
530 up(&JFS_IP(dip)->commit_sem); 530 mutex_unlock(&JFS_IP(dip)->commit_mutex);
531 up(&JFS_IP(ip)->commit_sem); 531 mutex_unlock(&JFS_IP(ip)->commit_mutex);
532 IWRITE_UNLOCK(ip); 532 IWRITE_UNLOCK(ip);
533 rc = new_size; 533 rc = new_size;
534 goto out1; 534 goto out1;
@@ -556,13 +556,13 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
556 556
557 txEnd(tid); 557 txEnd(tid);
558 558
559 up(&JFS_IP(dip)->commit_sem); 559 mutex_unlock(&JFS_IP(dip)->commit_mutex);
560 up(&JFS_IP(ip)->commit_sem); 560 mutex_unlock(&JFS_IP(ip)->commit_mutex);
561 561
562 562
563 while (new_size && (rc == 0)) { 563 while (new_size && (rc == 0)) {
564 tid = txBegin(dip->i_sb, 0); 564 tid = txBegin(dip->i_sb, 0);
565 down(&JFS_IP(ip)->commit_sem); 565 mutex_lock(&JFS_IP(ip)->commit_mutex);
566 new_size = xtTruncate_pmap(tid, ip, new_size); 566 new_size = xtTruncate_pmap(tid, ip, new_size);
567 if (new_size < 0) { 567 if (new_size < 0) {
568 txAbort(tid, 1); /* Marks FS Dirty */ 568 txAbort(tid, 1); /* Marks FS Dirty */
@@ -570,7 +570,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
570 } else 570 } else
571 rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC); 571 rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC);
572 txEnd(tid); 572 txEnd(tid);
573 up(&JFS_IP(ip)->commit_sem); 573 mutex_unlock(&JFS_IP(ip)->commit_mutex);
574 } 574 }
575 575
576 if (ip->i_nlink == 0) 576 if (ip->i_nlink == 0)
@@ -805,8 +805,8 @@ static int jfs_link(struct dentry *old_dentry,
805 805
806 tid = txBegin(ip->i_sb, 0); 806 tid = txBegin(ip->i_sb, 0);
807 807
808 down(&JFS_IP(dir)->commit_sem); 808 mutex_lock(&JFS_IP(dir)->commit_mutex);
809 down(&JFS_IP(ip)->commit_sem); 809 mutex_lock(&JFS_IP(ip)->commit_mutex);
810 810
811 /* 811 /*
812 * scan parent directory for entry/freespace 812 * scan parent directory for entry/freespace
@@ -847,8 +847,8 @@ static int jfs_link(struct dentry *old_dentry,
847 out: 847 out:
848 txEnd(tid); 848 txEnd(tid);
849 849
850 up(&JFS_IP(dir)->commit_sem); 850 mutex_unlock(&JFS_IP(dir)->commit_mutex);
851 up(&JFS_IP(ip)->commit_sem); 851 mutex_unlock(&JFS_IP(ip)->commit_mutex);
852 852
853 jfs_info("jfs_link: rc:%d", rc); 853 jfs_info("jfs_link: rc:%d", rc);
854 return rc; 854 return rc;
@@ -916,8 +916,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
916 916
917 tid = txBegin(dip->i_sb, 0); 917 tid = txBegin(dip->i_sb, 0);
918 918
919 down(&JFS_IP(dip)->commit_sem); 919 mutex_lock(&JFS_IP(dip)->commit_mutex);
920 down(&JFS_IP(ip)->commit_sem); 920 mutex_lock(&JFS_IP(ip)->commit_mutex);
921 921
922 rc = jfs_init_security(tid, ip, dip); 922 rc = jfs_init_security(tid, ip, dip);
923 if (rc) 923 if (rc)
@@ -1037,8 +1037,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1037 1037
1038 out3: 1038 out3:
1039 txEnd(tid); 1039 txEnd(tid);
1040 up(&JFS_IP(dip)->commit_sem); 1040 mutex_unlock(&JFS_IP(dip)->commit_mutex);
1041 up(&JFS_IP(ip)->commit_sem); 1041 mutex_unlock(&JFS_IP(ip)->commit_mutex);
1042 if (rc) { 1042 if (rc) {
1043 free_ea_wmap(ip); 1043 free_ea_wmap(ip);
1044 ip->i_nlink = 0; 1044 ip->i_nlink = 0;
@@ -1141,13 +1141,13 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1141 */ 1141 */
1142 tid = txBegin(new_dir->i_sb, 0); 1142 tid = txBegin(new_dir->i_sb, 0);
1143 1143
1144 down(&JFS_IP(new_dir)->commit_sem); 1144 mutex_lock(&JFS_IP(new_dir)->commit_mutex);
1145 down(&JFS_IP(old_ip)->commit_sem); 1145 mutex_lock(&JFS_IP(old_ip)->commit_mutex);
1146 if (old_dir != new_dir) 1146 if (old_dir != new_dir)
1147 down(&JFS_IP(old_dir)->commit_sem); 1147 mutex_lock(&JFS_IP(old_dir)->commit_mutex);
1148 1148
1149 if (new_ip) { 1149 if (new_ip) {
1150 down(&JFS_IP(new_ip)->commit_sem); 1150 mutex_lock(&JFS_IP(new_ip)->commit_mutex);
1151 /* 1151 /*
1152 * Change existing directory entry to new inode number 1152 * Change existing directory entry to new inode number
1153 */ 1153 */
@@ -1160,10 +1160,10 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1160 if (S_ISDIR(new_ip->i_mode)) { 1160 if (S_ISDIR(new_ip->i_mode)) {
1161 new_ip->i_nlink--; 1161 new_ip->i_nlink--;
1162 if (new_ip->i_nlink) { 1162 if (new_ip->i_nlink) {
1163 up(&JFS_IP(new_dir)->commit_sem); 1163 mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
1164 up(&JFS_IP(old_ip)->commit_sem); 1164 mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
1165 if (old_dir != new_dir) 1165 if (old_dir != new_dir)
1166 up(&JFS_IP(old_dir)->commit_sem); 1166 mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
1167 if (!S_ISDIR(old_ip->i_mode) && new_ip) 1167 if (!S_ISDIR(old_ip->i_mode) && new_ip)
1168 IWRITE_UNLOCK(new_ip); 1168 IWRITE_UNLOCK(new_ip);
1169 jfs_error(new_ip->i_sb, 1169 jfs_error(new_ip->i_sb,
@@ -1282,16 +1282,16 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1282 out4: 1282 out4:
1283 txEnd(tid); 1283 txEnd(tid);
1284 1284
1285 up(&JFS_IP(new_dir)->commit_sem); 1285 mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
1286 up(&JFS_IP(old_ip)->commit_sem); 1286 mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
1287 if (old_dir != new_dir) 1287 if (old_dir != new_dir)
1288 up(&JFS_IP(old_dir)->commit_sem); 1288 mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
1289 if (new_ip) 1289 if (new_ip)
1290 up(&JFS_IP(new_ip)->commit_sem); 1290 mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
1291 1291
1292 while (new_size && (rc == 0)) { 1292 while (new_size && (rc == 0)) {
1293 tid = txBegin(new_ip->i_sb, 0); 1293 tid = txBegin(new_ip->i_sb, 0);
1294 down(&JFS_IP(new_ip)->commit_sem); 1294 mutex_lock(&JFS_IP(new_ip)->commit_mutex);
1295 new_size = xtTruncate_pmap(tid, new_ip, new_size); 1295 new_size = xtTruncate_pmap(tid, new_ip, new_size);
1296 if (new_size < 0) { 1296 if (new_size < 0) {
1297 txAbort(tid, 1); 1297 txAbort(tid, 1);
@@ -1299,7 +1299,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1299 } else 1299 } else
1300 rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); 1300 rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC);
1301 txEnd(tid); 1301 txEnd(tid);
1302 up(&JFS_IP(new_ip)->commit_sem); 1302 mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
1303 } 1303 }
1304 if (new_ip && (new_ip->i_nlink == 0)) 1304 if (new_ip && (new_ip->i_nlink == 0))
1305 set_cflag(COMMIT_Nolink, new_ip); 1305 set_cflag(COMMIT_Nolink, new_ip);
@@ -1361,8 +1361,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1361 1361
1362 tid = txBegin(dir->i_sb, 0); 1362 tid = txBegin(dir->i_sb, 0);
1363 1363
1364 down(&JFS_IP(dir)->commit_sem); 1364 mutex_lock(&JFS_IP(dir)->commit_mutex);
1365 down(&JFS_IP(ip)->commit_sem); 1365 mutex_lock(&JFS_IP(ip)->commit_mutex);
1366 1366
1367 rc = jfs_init_acl(tid, ip, dir); 1367 rc = jfs_init_acl(tid, ip, dir);
1368 if (rc) 1368 if (rc)
@@ -1407,8 +1407,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1407 1407
1408 out3: 1408 out3:
1409 txEnd(tid); 1409 txEnd(tid);
1410 up(&JFS_IP(ip)->commit_sem); 1410 mutex_unlock(&JFS_IP(ip)->commit_mutex);
1411 up(&JFS_IP(dir)->commit_sem); 1411 mutex_unlock(&JFS_IP(dir)->commit_mutex);
1412 if (rc) { 1412 if (rc) {
1413 free_ea_wmap(ip); 1413 free_ea_wmap(ip);
1414 ip->i_nlink = 0; 1414 ip->i_nlink = 0;
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 8d31f1336431..1639d2cd371f 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -617,7 +617,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
617 memset(jfs_ip, 0, sizeof(struct jfs_inode_info)); 617 memset(jfs_ip, 0, sizeof(struct jfs_inode_info));
618 INIT_LIST_HEAD(&jfs_ip->anon_inode_list); 618 INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
619 init_rwsem(&jfs_ip->rdwrlock); 619 init_rwsem(&jfs_ip->rdwrlock);
620 init_MUTEX(&jfs_ip->commit_sem); 620 mutex_init(&jfs_ip->commit_mutex);
621 init_rwsem(&jfs_ip->xattr_sem); 621 init_rwsem(&jfs_ip->xattr_sem);
622 spin_lock_init(&jfs_ip->ag_lock); 622 spin_lock_init(&jfs_ip->ag_lock);
623 jfs_ip->active_ag = -1; 623 jfs_ip->active_ag = -1;
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index f23048f9471f..9bc5b7c055ce 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -934,13 +934,13 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,
934 } 934 }
935 935
936 tid = txBegin(inode->i_sb, 0); 936 tid = txBegin(inode->i_sb, 0);
937 down(&ji->commit_sem); 937 mutex_lock(&ji->commit_mutex);
938 rc = __jfs_setxattr(tid, dentry->d_inode, name, value, value_len, 938 rc = __jfs_setxattr(tid, dentry->d_inode, name, value, value_len,
939 flags); 939 flags);
940 if (!rc) 940 if (!rc)
941 rc = txCommit(tid, 1, &inode, 0); 941 rc = txCommit(tid, 1, &inode, 0);
942 txEnd(tid); 942 txEnd(tid);
943 up(&ji->commit_sem); 943 mutex_unlock(&ji->commit_mutex);
944 944
945 return rc; 945 return rc;
946} 946}
@@ -1093,12 +1093,12 @@ int jfs_removexattr(struct dentry *dentry, const char *name)
1093 return rc; 1093 return rc;
1094 1094
1095 tid = txBegin(inode->i_sb, 0); 1095 tid = txBegin(inode->i_sb, 0);
1096 down(&ji->commit_sem); 1096 mutex_lock(&ji->commit_mutex);
1097 rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE); 1097 rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE);
1098 if (!rc) 1098 if (!rc)
1099 rc = txCommit(tid, 1, &inode, 0); 1099 rc = txCommit(tid, 1, &inode, 0);
1100 txEnd(tid); 1100 txEnd(tid);
1101 up(&ji->commit_sem); 1101 mutex_unlock(&ji->commit_mutex);
1102 1102
1103 return rc; 1103 return rc;
1104} 1104}