aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/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/udf/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/udf/namei.c')
-rw-r--r--fs/udf/namei.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index ab9a7629d23e..d14d25534aa8 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -878,8 +878,7 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
878 inode->i_nlink); 878 inode->i_nlink);
879 inode->i_nlink = 0; 879 inode->i_nlink = 0;
880 inode->i_size = 0; 880 inode->i_size = 0;
881 mark_inode_dirty(inode); 881 inode_dec_link_count(inode);
882 dir->i_nlink --;
883 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 882 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
884 mark_inode_dirty(dir); 883 mark_inode_dirty(dir);
885 884
@@ -923,8 +922,7 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry)
923 goto end_unlink; 922 goto end_unlink;
924 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 923 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
925 mark_inode_dirty(dir); 924 mark_inode_dirty(dir);
926 inode->i_nlink--; 925 inode_dec_link_count(inode);
927 mark_inode_dirty(inode);
928 inode->i_ctime = dir->i_ctime; 926 inode->i_ctime = dir->i_ctime;
929 retval = 0; 927 retval = 0;
930 928
@@ -1101,8 +1099,7 @@ out:
1101 return err; 1099 return err;
1102 1100
1103out_no_entry: 1101out_no_entry:
1104 inode->i_nlink--; 1102 inode_dec_link_count(inode);
1105 mark_inode_dirty(inode);
1106 iput(inode); 1103 iput(inode);
1107 goto out; 1104 goto out;
1108} 1105}
@@ -1261,9 +1258,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1261 1258
1262 if (new_inode) 1259 if (new_inode)
1263 { 1260 {
1264 new_inode->i_nlink--;
1265 new_inode->i_ctime = current_fs_time(new_inode->i_sb); 1261 new_inode->i_ctime = current_fs_time(new_inode->i_sb);
1266 mark_inode_dirty(new_inode); 1262 inode_dec_link_count(new_inode);
1267 } 1263 }
1268 old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb); 1264 old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb);
1269 mark_inode_dirty(old_dir); 1265 mark_inode_dirty(old_dir);
@@ -1279,12 +1275,10 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1279 } 1275 }
1280 else 1276 else
1281 mark_buffer_dirty_inode(dir_bh, old_inode); 1277 mark_buffer_dirty_inode(dir_bh, old_inode);
1282 old_dir->i_nlink --; 1278 inode_dec_link_count(old_dir);
1283 mark_inode_dirty(old_dir);
1284 if (new_inode) 1279 if (new_inode)
1285 { 1280 {
1286 new_inode->i_nlink --; 1281 inode_dec_link_count(new_inode);
1287 mark_inode_dirty(new_inode);
1288 } 1282 }
1289 else 1283 else
1290 { 1284 {