aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2006-10-01 02:29:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:30 -0400
commit9a53c3a783c2fa9b969628e65695c11c3e51e673 (patch)
tree5a6115e18ee105246d46e3db3d5b07749d232f5b /fs/jfs
parentaab520e2f6c80160cabd187a8d0292d1cec8ff68 (diff)
[PATCH] r/o bind mounts: unlink: monitor i_nlink
When a filesystem decrements i_nlink to zero, it means that a write must be performed in order to drop the inode from the filesystem. We're shortly going to have keep filesystems from being remounted r/o between the time that this i_nlink decrement and that write occurs. So, add a little helper function to do the decrements. We'll tie into it in a bit to note when i_nlink hits zero. Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Acked-by: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/namei.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 295268ad231b..088b85976ac0 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -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
@@ -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
@@ -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)
@@ -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