diff options
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r-- | fs/udf/namei.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index ab9a7629d23e..73163325e5ec 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -762,7 +762,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
762 | cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); | 762 | cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); |
763 | cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; | 763 | cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; |
764 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 764 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
765 | dir->i_nlink++; | 765 | inc_nlink(dir); |
766 | mark_inode_dirty(dir); | 766 | mark_inode_dirty(dir); |
767 | d_instantiate(dentry, inode); | 767 | d_instantiate(dentry, inode); |
768 | if (fibh.sbh != fibh.ebh) | 768 | if (fibh.sbh != fibh.ebh) |
@@ -876,10 +876,9 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry) | |||
876 | udf_warning(inode->i_sb, "udf_rmdir", | 876 | udf_warning(inode->i_sb, "udf_rmdir", |
877 | "empty directory has nlink != 2 (%d)", | 877 | "empty directory has nlink != 2 (%d)", |
878 | inode->i_nlink); | 878 | inode->i_nlink); |
879 | inode->i_nlink = 0; | 879 | clear_nlink(inode); |
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 | ||
1103 | out_no_entry: | 1101 | out_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 | } |
@@ -1150,7 +1147,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir, | |||
1150 | if (fibh.sbh != fibh.ebh) | 1147 | if (fibh.sbh != fibh.ebh) |
1151 | udf_release_data(fibh.ebh); | 1148 | udf_release_data(fibh.ebh); |
1152 | udf_release_data(fibh.sbh); | 1149 | udf_release_data(fibh.sbh); |
1153 | inode->i_nlink ++; | 1150 | inc_nlink(inode); |
1154 | inode->i_ctime = current_fs_time(inode->i_sb); | 1151 | inode->i_ctime = current_fs_time(inode->i_sb); |
1155 | mark_inode_dirty(inode); | 1152 | mark_inode_dirty(inode); |
1156 | atomic_inc(&inode->i_count); | 1153 | atomic_inc(&inode->i_count); |
@@ -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,16 +1275,14 @@ 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 | { |
1291 | new_dir->i_nlink ++; | 1285 | inc_nlink(new_dir); |
1292 | mark_inode_dirty(new_dir); | 1286 | mark_inode_dirty(new_dir); |
1293 | } | 1287 | } |
1294 | } | 1288 | } |