aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/inode.c')
-rw-r--r--fs/jfs/inode.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 9f942ca8e4e3..51a5fed90cca 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -55,6 +55,7 @@ void jfs_read_inode(struct inode *inode)
55 inode->i_op = &jfs_file_inode_operations; 55 inode->i_op = &jfs_file_inode_operations;
56 init_special_inode(inode, inode->i_mode, inode->i_rdev); 56 init_special_inode(inode, inode->i_mode, inode->i_rdev);
57 } 57 }
58 jfs_set_inode_flags(inode);
58} 59}
59 60
60/* 61/*
@@ -89,16 +90,16 @@ int jfs_commit_inode(struct inode *inode, int wait)
89 } 90 }
90 91
91 tid = txBegin(inode->i_sb, COMMIT_INODE); 92 tid = txBegin(inode->i_sb, COMMIT_INODE);
92 down(&JFS_IP(inode)->commit_sem); 93 mutex_lock(&JFS_IP(inode)->commit_mutex);
93 94
94 /* 95 /*
95 * Retest inode state after taking commit_sem 96 * Retest inode state after taking commit_mutex
96 */ 97 */
97 if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) 98 if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode))
98 rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); 99 rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);
99 100
100 txEnd(tid); 101 txEnd(tid);
101 up(&JFS_IP(inode)->commit_sem); 102 mutex_unlock(&JFS_IP(inode)->commit_mutex);
102 return rc; 103 return rc;
103} 104}
104 105
@@ -335,18 +336,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
335 tid = txBegin(ip->i_sb, 0); 336 tid = txBegin(ip->i_sb, 0);
336 337
337 /* 338 /*
338 * The commit_sem cannot be taken before txBegin. 339 * The commit_mutex cannot be taken before txBegin.
339 * txBegin may block and there is a chance the inode 340 * txBegin may block and there is a chance the inode
340 * could be marked dirty and need to be committed 341 * could be marked dirty and need to be committed
341 * before txBegin unblocks 342 * before txBegin unblocks
342 */ 343 */
343 down(&JFS_IP(ip)->commit_sem); 344 mutex_lock(&JFS_IP(ip)->commit_mutex);
344 345
345 newsize = xtTruncate(tid, ip, length, 346 newsize = xtTruncate(tid, ip, length,
346 COMMIT_TRUNCATE | COMMIT_PWMAP); 347 COMMIT_TRUNCATE | COMMIT_PWMAP);
347 if (newsize < 0) { 348 if (newsize < 0) {
348 txEnd(tid); 349 txEnd(tid);
349 up(&JFS_IP(ip)->commit_sem); 350 mutex_unlock(&JFS_IP(ip)->commit_mutex);
350 break; 351 break;
351 } 352 }
352 353
@@ -355,7 +356,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
355 356
356 txCommit(tid, 1, &ip, 0); 357 txCommit(tid, 1, &ip, 0);
357 txEnd(tid); 358 txEnd(tid);
358 up(&JFS_IP(ip)->commit_sem); 359 mutex_unlock(&JFS_IP(ip)->commit_mutex);
359 } while (newsize > length); /* Truncate isn't always atomic */ 360 } while (newsize > length); /* Truncate isn't always atomic */
360} 361}
361 362