aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/namei.c
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/ext3/namei.c
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/ext3/namei.c')
-rw-r--r--fs/ext3/namei.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 235e77b52ea5..14c55adfae83 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1621,7 +1621,7 @@ static inline void ext3_inc_count(handle_t *handle, struct inode *inode)
1621 1621
1622static inline void ext3_dec_count(handle_t *handle, struct inode *inode) 1622static inline void ext3_dec_count(handle_t *handle, struct inode *inode)
1623{ 1623{
1624 inode->i_nlink--; 1624 drop_nlink(inode);
1625} 1625}
1626 1626
1627static int ext3_add_nondir(handle_t *handle, 1627static int ext3_add_nondir(handle_t *handle,
@@ -1743,7 +1743,7 @@ retry:
1743 inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; 1743 inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize;
1744 dir_block = ext3_bread (handle, inode, 0, 1, &err); 1744 dir_block = ext3_bread (handle, inode, 0, 1, &err);
1745 if (!dir_block) { 1745 if (!dir_block) {
1746 inode->i_nlink--; /* is this nlink == 0? */ 1746 drop_nlink(inode); /* is this nlink == 0? */
1747 ext3_mark_inode_dirty(handle, inode); 1747 ext3_mark_inode_dirty(handle, inode);
1748 iput (inode); 1748 iput (inode);
1749 goto out_stop; 1749 goto out_stop;
@@ -2053,7 +2053,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
2053 ext3_orphan_add(handle, inode); 2053 ext3_orphan_add(handle, inode);
2054 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 2054 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
2055 ext3_mark_inode_dirty(handle, inode); 2055 ext3_mark_inode_dirty(handle, inode);
2056 dir->i_nlink--; 2056 drop_nlink(dir);
2057 ext3_update_dx_flag(dir); 2057 ext3_update_dx_flag(dir);
2058 ext3_mark_inode_dirty(handle, dir); 2058 ext3_mark_inode_dirty(handle, dir);
2059 2059
@@ -2104,7 +2104,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
2104 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 2104 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
2105 ext3_update_dx_flag(dir); 2105 ext3_update_dx_flag(dir);
2106 ext3_mark_inode_dirty(handle, dir); 2106 ext3_mark_inode_dirty(handle, dir);
2107 inode->i_nlink--; 2107 drop_nlink(inode);
2108 if (!inode->i_nlink) 2108 if (!inode->i_nlink)
2109 ext3_orphan_add(handle, inode); 2109 ext3_orphan_add(handle, inode);
2110 inode->i_ctime = dir->i_ctime; 2110 inode->i_ctime = dir->i_ctime;
@@ -2326,7 +2326,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2326 } 2326 }
2327 2327
2328 if (new_inode) { 2328 if (new_inode) {
2329 new_inode->i_nlink--; 2329 drop_nlink(new_inode);
2330 new_inode->i_ctime = CURRENT_TIME_SEC; 2330 new_inode->i_ctime = CURRENT_TIME_SEC;
2331 } 2331 }
2332 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; 2332 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
@@ -2337,9 +2337,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2337 PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); 2337 PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino);
2338 BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); 2338 BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
2339 ext3_journal_dirty_metadata(handle, dir_bh); 2339 ext3_journal_dirty_metadata(handle, dir_bh);
2340 old_dir->i_nlink--; 2340 drop_nlink(old_dir);
2341 if (new_inode) { 2341 if (new_inode) {
2342 new_inode->i_nlink--; 2342 drop_nlink(new_inode);
2343 } else { 2343 } else {
2344 new_dir->i_nlink++; 2344 new_dir->i_nlink++;
2345 ext3_update_dx_flag(new_dir); 2345 ext3_update_dx_flag(new_dir);