diff options
Diffstat (limited to 'fs/jfs/namei.c')
-rw-r--r-- | fs/jfs/namei.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 295268ad231b..b8d16a6aa88f 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -292,7 +292,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
292 | mark_inode_dirty(ip); | 292 | mark_inode_dirty(ip); |
293 | 293 | ||
294 | /* update parent directory inode */ | 294 | /* update parent directory inode */ |
295 | dip->i_nlink++; /* for '..' from child directory */ | 295 | inc_nlink(dip); /* for '..' from child directory */ |
296 | dip->i_ctime = dip->i_mtime = CURRENT_TIME; | 296 | dip->i_ctime = dip->i_mtime = CURRENT_TIME; |
297 | mark_inode_dirty(dip); | 297 | mark_inode_dirty(dip); |
298 | 298 | ||
@@ -393,9 +393,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) | |||
393 | /* update parent directory's link count corresponding | 393 | /* update parent directory's link count corresponding |
394 | * to ".." entry of the target directory deleted | 394 | * to ".." entry of the target directory deleted |
395 | */ | 395 | */ |
396 | dip->i_nlink--; | ||
397 | dip->i_ctime = dip->i_mtime = CURRENT_TIME; | 396 | dip->i_ctime = dip->i_mtime = CURRENT_TIME; |
398 | mark_inode_dirty(dip); | 397 | inode_dec_link_count(dip); |
399 | 398 | ||
400 | /* | 399 | /* |
401 | * OS/2 could have created EA and/or ACL | 400 | * OS/2 could have created EA and/or ACL |
@@ -415,7 +414,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) | |||
415 | JFS_IP(ip)->acl.flag = 0; | 414 | JFS_IP(ip)->acl.flag = 0; |
416 | 415 | ||
417 | /* mark the target directory as deleted */ | 416 | /* mark the target directory as deleted */ |
418 | ip->i_nlink = 0; | 417 | clear_nlink(ip); |
419 | mark_inode_dirty(ip); | 418 | mark_inode_dirty(ip); |
420 | 419 | ||
421 | rc = txCommit(tid, 2, &iplist[0], 0); | 420 | rc = txCommit(tid, 2, &iplist[0], 0); |
@@ -515,8 +514,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) | |||
515 | mark_inode_dirty(dip); | 514 | mark_inode_dirty(dip); |
516 | 515 | ||
517 | /* update target's inode */ | 516 | /* update target's inode */ |
518 | ip->i_nlink--; | 517 | inode_dec_link_count(ip); |
519 | mark_inode_dirty(ip); | ||
520 | 518 | ||
521 | /* | 519 | /* |
522 | * commit zero link count object | 520 | * commit zero link count object |
@@ -824,7 +822,7 @@ static int jfs_link(struct dentry *old_dentry, | |||
824 | goto free_dname; | 822 | goto free_dname; |
825 | 823 | ||
826 | /* update object inode */ | 824 | /* update object inode */ |
827 | ip->i_nlink++; /* for new link */ | 825 | inc_nlink(ip); /* for new link */ |
828 | ip->i_ctime = CURRENT_TIME; | 826 | ip->i_ctime = CURRENT_TIME; |
829 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 827 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
830 | mark_inode_dirty(dir); | 828 | mark_inode_dirty(dir); |
@@ -835,7 +833,7 @@ static int jfs_link(struct dentry *old_dentry, | |||
835 | rc = txCommit(tid, 2, &iplist[0], 0); | 833 | rc = txCommit(tid, 2, &iplist[0], 0); |
836 | 834 | ||
837 | if (rc) { | 835 | if (rc) { |
838 | ip->i_nlink--; | 836 | ip->i_nlink--; /* never instantiated */ |
839 | iput(ip); | 837 | iput(ip); |
840 | } else | 838 | } else |
841 | d_instantiate(dentry, ip); | 839 | d_instantiate(dentry, ip); |
@@ -1155,9 +1153,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1155 | old_ip->i_ino, JFS_RENAME); | 1153 | old_ip->i_ino, JFS_RENAME); |
1156 | if (rc) | 1154 | if (rc) |
1157 | goto out4; | 1155 | goto out4; |
1158 | new_ip->i_nlink--; | 1156 | drop_nlink(new_ip); |
1159 | if (S_ISDIR(new_ip->i_mode)) { | 1157 | if (S_ISDIR(new_ip->i_mode)) { |
1160 | new_ip->i_nlink--; | 1158 | drop_nlink(new_ip); |
1161 | if (new_ip->i_nlink) { | 1159 | if (new_ip->i_nlink) { |
1162 | mutex_unlock(&JFS_IP(new_ip)->commit_mutex); | 1160 | mutex_unlock(&JFS_IP(new_ip)->commit_mutex); |
1163 | if (old_dir != new_dir) | 1161 | if (old_dir != new_dir) |
@@ -1208,7 +1206,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1208 | goto out4; | 1206 | goto out4; |
1209 | } | 1207 | } |
1210 | if (S_ISDIR(old_ip->i_mode)) | 1208 | if (S_ISDIR(old_ip->i_mode)) |
1211 | new_dir->i_nlink++; | 1209 | inc_nlink(new_dir); |
1212 | } | 1210 | } |
1213 | /* | 1211 | /* |
1214 | * Remove old directory entry | 1212 | * Remove old directory entry |
@@ -1223,7 +1221,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1223 | goto out4; | 1221 | goto out4; |
1224 | } | 1222 | } |
1225 | if (S_ISDIR(old_ip->i_mode)) { | 1223 | if (S_ISDIR(old_ip->i_mode)) { |
1226 | old_dir->i_nlink--; | 1224 | drop_nlink(old_dir); |
1227 | if (old_dir != new_dir) { | 1225 | if (old_dir != new_dir) { |
1228 | /* | 1226 | /* |
1229 | * Change inode number of parent for moved directory | 1227 | * Change inode number of parent for moved directory |