aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bfs
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/bfs
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/bfs')
-rw-r--r--fs/bfs/dir.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index dcf04cb13283..ce05d1643dd1 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -117,8 +117,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
117 117
118 err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, inode->i_ino); 118 err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, inode->i_ino);
119 if (err) { 119 if (err) {
120 inode->i_nlink--; 120 inode_dec_link_count(inode);
121 mark_inode_dirty(inode);
122 iput(inode); 121 iput(inode);
123 unlock_kernel(); 122 unlock_kernel();
124 return err; 123 return err;
@@ -196,9 +195,8 @@ static int bfs_unlink(struct inode * dir, struct dentry * dentry)
196 mark_buffer_dirty(bh); 195 mark_buffer_dirty(bh);
197 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 196 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
198 mark_inode_dirty(dir); 197 mark_inode_dirty(dir);
199 inode->i_nlink--;
200 inode->i_ctime = dir->i_ctime; 198 inode->i_ctime = dir->i_ctime;
201 mark_inode_dirty(inode); 199 inode_dec_link_count(inode);
202 error = 0; 200 error = 0;
203 201
204out_brelse: 202out_brelse:
@@ -249,9 +247,8 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry,
249 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; 247 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
250 mark_inode_dirty(old_dir); 248 mark_inode_dirty(old_dir);
251 if (new_inode) { 249 if (new_inode) {
252 new_inode->i_nlink--;
253 new_inode->i_ctime = CURRENT_TIME_SEC; 250 new_inode->i_ctime = CURRENT_TIME_SEC;
254 mark_inode_dirty(new_inode); 251 inode_dec_link_count(new_inode);
255 } 252 }
256 mark_buffer_dirty(old_bh); 253 mark_buffer_dirty(old_bh);
257 error = 0; 254 error = 0;