aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 20:14:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 20:14:59 -0500
commit2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (patch)
treef72a0d85e66f500b4cead348a231e3d3b9f357bc /fs/ext4/namei.c
parentcd764695b67386a81964f68e9c66efd9f13f4d29 (diff)
parent4b905671d2ea09fd48fed72c581df17e40823f39 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (57 commits) jbd2: Fix oops in jbd2_journal_init_inode() on corrupted fs ext4: Remove "extents" mount option block: Add Kconfig help which notes that ext4 needs CONFIG_LBD ext4: Make printk's consistently prefixed with "EXT4-fs: " ext4: Add sanity checks for the superblock before mounting the filesystem ext4: Add mount option to set kjournald's I/O priority jbd2: Submit writes to the journal using WRITE_SYNC jbd2: Add pid and journal device name to the "kjournald2 starting" message ext4: Add markers for better debuggability ext4: Remove code to create the journal inode ext4: provide function to release metadata pages under memory pressure ext3: provide function to release metadata pages under memory pressure add releasepage hooks to block devices which can be used by file systems ext4: Fix s_dirty_blocks_counter if block allocation failed with nodelalloc ext4: Init the complete page while building buddy cache ext4: Don't allow new groups to be added during block allocation ext4: mark the blocks/inode bitmap beyond end of group as used ext4: Use new buffer_head flag to check uninit group bitmaps initialization ext4: Fix the race between read_inode_bitmap() and ext4_new_inode() ext4: code cleanup ...
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c92
1 files changed, 52 insertions, 40 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 4b8d431d7dff..fec0b4c2f5f1 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -368,6 +368,8 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
368 goto fail; 368 goto fail;
369 } 369 }
370 hinfo->hash_version = root->info.hash_version; 370 hinfo->hash_version = root->info.hash_version;
371 if (hinfo->hash_version <= DX_HASH_TEA)
372 hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
371 hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed; 373 hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
372 if (d_name) 374 if (d_name)
373 ext4fs_dirhash(d_name->name, d_name->len, hinfo); 375 ext4fs_dirhash(d_name->name, d_name->len, hinfo);
@@ -637,6 +639,9 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
637 dir = dir_file->f_path.dentry->d_inode; 639 dir = dir_file->f_path.dentry->d_inode;
638 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) { 640 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) {
639 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; 641 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
642 if (hinfo.hash_version <= DX_HASH_TEA)
643 hinfo.hash_version +=
644 EXT4_SB(dir->i_sb)->s_hash_unsigned;
640 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 645 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
641 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, 646 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo,
642 start_hash, start_minor_hash); 647 start_hash, start_minor_hash);
@@ -802,7 +807,7 @@ static inline int ext4_match (int len, const char * const name,
802static inline int search_dirblock(struct buffer_head *bh, 807static inline int search_dirblock(struct buffer_head *bh,
803 struct inode *dir, 808 struct inode *dir,
804 const struct qstr *d_name, 809 const struct qstr *d_name,
805 unsigned long offset, 810 unsigned int offset,
806 struct ext4_dir_entry_2 ** res_dir) 811 struct ext4_dir_entry_2 ** res_dir)
807{ 812{
808 struct ext4_dir_entry_2 * de; 813 struct ext4_dir_entry_2 * de;
@@ -1039,11 +1044,11 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
1039 bh = ext4_find_entry(dir, &dentry->d_name, &de); 1044 bh = ext4_find_entry(dir, &dentry->d_name, &de);
1040 inode = NULL; 1045 inode = NULL;
1041 if (bh) { 1046 if (bh) {
1042 unsigned long ino = le32_to_cpu(de->inode); 1047 __u32 ino = le32_to_cpu(de->inode);
1043 brelse(bh); 1048 brelse(bh);
1044 if (!ext4_valid_inum(dir->i_sb, ino)) { 1049 if (!ext4_valid_inum(dir->i_sb, ino)) {
1045 ext4_error(dir->i_sb, "ext4_lookup", 1050 ext4_error(dir->i_sb, "ext4_lookup",
1046 "bad inode number: %lu", ino); 1051 "bad inode number: %u", ino);
1047 return ERR_PTR(-EIO); 1052 return ERR_PTR(-EIO);
1048 } 1053 }
1049 inode = ext4_iget(dir->i_sb, ino); 1054 inode = ext4_iget(dir->i_sb, ino);
@@ -1056,7 +1061,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
1056 1061
1057struct dentry *ext4_get_parent(struct dentry *child) 1062struct dentry *ext4_get_parent(struct dentry *child)
1058{ 1063{
1059 unsigned long ino; 1064 __u32 ino;
1060 struct inode *inode; 1065 struct inode *inode;
1061 static const struct qstr dotdot = { 1066 static const struct qstr dotdot = {
1062 .name = "..", 1067 .name = "..",
@@ -1074,7 +1079,7 @@ struct dentry *ext4_get_parent(struct dentry *child)
1074 1079
1075 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { 1080 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) {
1076 ext4_error(child->d_inode->i_sb, "ext4_get_parent", 1081 ext4_error(child->d_inode->i_sb, "ext4_get_parent",
1077 "bad inode number: %lu", ino); 1082 "bad inode number: %u", ino);
1078 return ERR_PTR(-EIO); 1083 return ERR_PTR(-EIO);
1079 } 1084 }
1080 1085
@@ -1162,9 +1167,9 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1162 u32 hash2; 1167 u32 hash2;
1163 struct dx_map_entry *map; 1168 struct dx_map_entry *map;
1164 char *data1 = (*bh)->b_data, *data2; 1169 char *data1 = (*bh)->b_data, *data2;
1165 unsigned split, move, size, i; 1170 unsigned split, move, size;
1166 struct ext4_dir_entry_2 *de = NULL, *de2; 1171 struct ext4_dir_entry_2 *de = NULL, *de2;
1167 int err = 0; 1172 int err = 0, i;
1168 1173
1169 bh2 = ext4_append (handle, dir, &newblock, &err); 1174 bh2 = ext4_append (handle, dir, &newblock, &err);
1170 if (!(bh2)) { 1175 if (!(bh2)) {
@@ -1224,10 +1229,10 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1224 de = de2; 1229 de = de2;
1225 } 1230 }
1226 dx_insert_block(frame, hash2 + continued, newblock); 1231 dx_insert_block(frame, hash2 + continued, newblock);
1227 err = ext4_journal_dirty_metadata(handle, bh2); 1232 err = ext4_handle_dirty_metadata(handle, dir, bh2);
1228 if (err) 1233 if (err)
1229 goto journal_error; 1234 goto journal_error;
1230 err = ext4_journal_dirty_metadata(handle, frame->bh); 1235 err = ext4_handle_dirty_metadata(handle, dir, frame->bh);
1231 if (err) 1236 if (err)
1232 goto journal_error; 1237 goto journal_error;
1233 brelse(bh2); 1238 brelse(bh2);
@@ -1262,7 +1267,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1262 struct inode *dir = dentry->d_parent->d_inode; 1267 struct inode *dir = dentry->d_parent->d_inode;
1263 const char *name = dentry->d_name.name; 1268 const char *name = dentry->d_name.name;
1264 int namelen = dentry->d_name.len; 1269 int namelen = dentry->d_name.len;
1265 unsigned long offset = 0; 1270 unsigned int offset = 0;
1266 unsigned short reclen; 1271 unsigned short reclen;
1267 int nlen, rlen, err; 1272 int nlen, rlen, err;
1268 char *top; 1273 char *top;
@@ -1331,8 +1336,8 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1331 ext4_update_dx_flag(dir); 1336 ext4_update_dx_flag(dir);
1332 dir->i_version++; 1337 dir->i_version++;
1333 ext4_mark_inode_dirty(handle, dir); 1338 ext4_mark_inode_dirty(handle, dir);
1334 BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata"); 1339 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
1335 err = ext4_journal_dirty_metadata(handle, bh); 1340 err = ext4_handle_dirty_metadata(handle, dir, bh);
1336 if (err) 1341 if (err)
1337 ext4_std_error(dir->i_sb, err); 1342 ext4_std_error(dir->i_sb, err);
1338 brelse(bh); 1343 brelse(bh);
@@ -1404,6 +1409,8 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1404 1409
1405 /* Initialize as for dx_probe */ 1410 /* Initialize as for dx_probe */
1406 hinfo.hash_version = root->info.hash_version; 1411 hinfo.hash_version = root->info.hash_version;
1412 if (hinfo.hash_version <= DX_HASH_TEA)
1413 hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
1407 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 1414 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
1408 ext4fs_dirhash(name, namelen, &hinfo); 1415 ext4fs_dirhash(name, namelen, &hinfo);
1409 frame = frames; 1416 frame = frames;
@@ -1433,7 +1440,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1433 struct inode *inode) 1440 struct inode *inode)
1434{ 1441{
1435 struct inode *dir = dentry->d_parent->d_inode; 1442 struct inode *dir = dentry->d_parent->d_inode;
1436 unsigned long offset;
1437 struct buffer_head *bh; 1443 struct buffer_head *bh;
1438 struct ext4_dir_entry_2 *de; 1444 struct ext4_dir_entry_2 *de;
1439 struct super_block *sb; 1445 struct super_block *sb;
@@ -1455,7 +1461,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1455 ext4_mark_inode_dirty(handle, dir); 1461 ext4_mark_inode_dirty(handle, dir);
1456 } 1462 }
1457 blocks = dir->i_size >> sb->s_blocksize_bits; 1463 blocks = dir->i_size >> sb->s_blocksize_bits;
1458 for (block = 0, offset = 0; block < blocks; block++) { 1464 for (block = 0; block < blocks; block++) {
1459 bh = ext4_bread(handle, dir, block, 0, &retval); 1465 bh = ext4_bread(handle, dir, block, 0, &retval);
1460 if(!bh) 1466 if(!bh)
1461 return retval; 1467 return retval;
@@ -1570,7 +1576,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1570 dxtrace(dx_show_index("node", frames[1].entries)); 1576 dxtrace(dx_show_index("node", frames[1].entries));
1571 dxtrace(dx_show_index("node", 1577 dxtrace(dx_show_index("node",
1572 ((struct dx_node *) bh2->b_data)->entries)); 1578 ((struct dx_node *) bh2->b_data)->entries));
1573 err = ext4_journal_dirty_metadata(handle, bh2); 1579 err = ext4_handle_dirty_metadata(handle, inode, bh2);
1574 if (err) 1580 if (err)
1575 goto journal_error; 1581 goto journal_error;
1576 brelse (bh2); 1582 brelse (bh2);
@@ -1596,7 +1602,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1596 if (err) 1602 if (err)
1597 goto journal_error; 1603 goto journal_error;
1598 } 1604 }
1599 ext4_journal_dirty_metadata(handle, frames[0].bh); 1605 ext4_handle_dirty_metadata(handle, inode, frames[0].bh);
1600 } 1606 }
1601 de = do_split(handle, dir, &bh, frame, &hinfo, &err); 1607 de = do_split(handle, dir, &bh, frame, &hinfo, &err);
1602 if (!de) 1608 if (!de)
@@ -1642,8 +1648,8 @@ static int ext4_delete_entry(handle_t *handle,
1642 else 1648 else
1643 de->inode = 0; 1649 de->inode = 0;
1644 dir->i_version++; 1650 dir->i_version++;
1645 BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata"); 1651 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
1646 ext4_journal_dirty_metadata(handle, bh); 1652 ext4_handle_dirty_metadata(handle, dir, bh);
1647 return 0; 1653 return 0;
1648 } 1654 }
1649 i += ext4_rec_len_from_disk(de->rec_len); 1655 i += ext4_rec_len_from_disk(de->rec_len);
@@ -1721,7 +1727,7 @@ retry:
1721 return PTR_ERR(handle); 1727 return PTR_ERR(handle);
1722 1728
1723 if (IS_DIRSYNC(dir)) 1729 if (IS_DIRSYNC(dir))
1724 handle->h_sync = 1; 1730 ext4_handle_sync(handle);
1725 1731
1726 inode = ext4_new_inode (handle, dir, mode); 1732 inode = ext4_new_inode (handle, dir, mode);
1727 err = PTR_ERR(inode); 1733 err = PTR_ERR(inode);
@@ -1755,7 +1761,7 @@ retry:
1755 return PTR_ERR(handle); 1761 return PTR_ERR(handle);
1756 1762
1757 if (IS_DIRSYNC(dir)) 1763 if (IS_DIRSYNC(dir))
1758 handle->h_sync = 1; 1764 ext4_handle_sync(handle);
1759 1765
1760 inode = ext4_new_inode(handle, dir, mode); 1766 inode = ext4_new_inode(handle, dir, mode);
1761 err = PTR_ERR(inode); 1767 err = PTR_ERR(inode);
@@ -1791,7 +1797,7 @@ retry:
1791 return PTR_ERR(handle); 1797 return PTR_ERR(handle);
1792 1798
1793 if (IS_DIRSYNC(dir)) 1799 if (IS_DIRSYNC(dir))
1794 handle->h_sync = 1; 1800 ext4_handle_sync(handle);
1795 1801
1796 inode = ext4_new_inode(handle, dir, S_IFDIR | mode); 1802 inode = ext4_new_inode(handle, dir, S_IFDIR | mode);
1797 err = PTR_ERR(inode); 1803 err = PTR_ERR(inode);
@@ -1820,8 +1826,8 @@ retry:
1820 strcpy(de->name, ".."); 1826 strcpy(de->name, "..");
1821 ext4_set_de_type(dir->i_sb, de, S_IFDIR); 1827 ext4_set_de_type(dir->i_sb, de, S_IFDIR);
1822 inode->i_nlink = 2; 1828 inode->i_nlink = 2;
1823 BUFFER_TRACE(dir_block, "call ext4_journal_dirty_metadata"); 1829 BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
1824 ext4_journal_dirty_metadata(handle, dir_block); 1830 ext4_handle_dirty_metadata(handle, dir, dir_block);
1825 brelse(dir_block); 1831 brelse(dir_block);
1826 ext4_mark_inode_dirty(handle, inode); 1832 ext4_mark_inode_dirty(handle, inode);
1827 err = ext4_add_entry(handle, dentry, inode); 1833 err = ext4_add_entry(handle, dentry, inode);
@@ -1850,7 +1856,7 @@ out_stop:
1850 */ 1856 */
1851static int empty_dir(struct inode *inode) 1857static int empty_dir(struct inode *inode)
1852{ 1858{
1853 unsigned long offset; 1859 unsigned int offset;
1854 struct buffer_head *bh; 1860 struct buffer_head *bh;
1855 struct ext4_dir_entry_2 *de, *de1; 1861 struct ext4_dir_entry_2 *de, *de1;
1856 struct super_block *sb; 1862 struct super_block *sb;
@@ -1895,7 +1901,7 @@ static int empty_dir(struct inode *inode)
1895 if (err) 1901 if (err)
1896 ext4_error(sb, __func__, 1902 ext4_error(sb, __func__,
1897 "error %d reading directory" 1903 "error %d reading directory"
1898 " #%lu offset %lu", 1904 " #%lu offset %u",
1899 err, inode->i_ino, offset); 1905 err, inode->i_ino, offset);
1900 offset += sb->s_blocksize; 1906 offset += sb->s_blocksize;
1901 continue; 1907 continue;
@@ -1933,6 +1939,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
1933 struct ext4_iloc iloc; 1939 struct ext4_iloc iloc;
1934 int err = 0, rc; 1940 int err = 0, rc;
1935 1941
1942 if (!ext4_handle_valid(handle))
1943 return 0;
1944
1936 lock_super(sb); 1945 lock_super(sb);
1937 if (!list_empty(&EXT4_I(inode)->i_orphan)) 1946 if (!list_empty(&EXT4_I(inode)->i_orphan))
1938 goto out_unlock; 1947 goto out_unlock;
@@ -1961,7 +1970,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
1961 /* Insert this inode at the head of the on-disk orphan list... */ 1970 /* Insert this inode at the head of the on-disk orphan list... */
1962 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan); 1971 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
1963 EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino); 1972 EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1964 err = ext4_journal_dirty_metadata(handle, EXT4_SB(sb)->s_sbh); 1973 err = ext4_handle_dirty_metadata(handle, inode, EXT4_SB(sb)->s_sbh);
1965 rc = ext4_mark_iloc_dirty(handle, inode, &iloc); 1974 rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
1966 if (!err) 1975 if (!err)
1967 err = rc; 1976 err = rc;
@@ -1995,10 +2004,13 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
1995 struct list_head *prev; 2004 struct list_head *prev;
1996 struct ext4_inode_info *ei = EXT4_I(inode); 2005 struct ext4_inode_info *ei = EXT4_I(inode);
1997 struct ext4_sb_info *sbi; 2006 struct ext4_sb_info *sbi;
1998 unsigned long ino_next; 2007 __u32 ino_next;
1999 struct ext4_iloc iloc; 2008 struct ext4_iloc iloc;
2000 int err = 0; 2009 int err = 0;
2001 2010
2011 if (!ext4_handle_valid(handle))
2012 return 0;
2013
2002 lock_super(inode->i_sb); 2014 lock_super(inode->i_sb);
2003 if (list_empty(&ei->i_orphan)) { 2015 if (list_empty(&ei->i_orphan)) {
2004 unlock_super(inode->i_sb); 2016 unlock_super(inode->i_sb);
@@ -2017,7 +2029,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2017 * transaction handle with which to update the orphan list on 2029 * transaction handle with which to update the orphan list on
2018 * disk, but we still need to remove the inode from the linked 2030 * disk, but we still need to remove the inode from the linked
2019 * list in memory. */ 2031 * list in memory. */
2020 if (!handle) 2032 if (sbi->s_journal && !handle)
2021 goto out; 2033 goto out;
2022 2034
2023 err = ext4_reserve_inode_write(handle, inode, &iloc); 2035 err = ext4_reserve_inode_write(handle, inode, &iloc);
@@ -2025,19 +2037,19 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2025 goto out_err; 2037 goto out_err;
2026 2038
2027 if (prev == &sbi->s_orphan) { 2039 if (prev == &sbi->s_orphan) {
2028 jbd_debug(4, "superblock will point to %lu\n", ino_next); 2040 jbd_debug(4, "superblock will point to %u\n", ino_next);
2029 BUFFER_TRACE(sbi->s_sbh, "get_write_access"); 2041 BUFFER_TRACE(sbi->s_sbh, "get_write_access");
2030 err = ext4_journal_get_write_access(handle, sbi->s_sbh); 2042 err = ext4_journal_get_write_access(handle, sbi->s_sbh);
2031 if (err) 2043 if (err)
2032 goto out_brelse; 2044 goto out_brelse;
2033 sbi->s_es->s_last_orphan = cpu_to_le32(ino_next); 2045 sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
2034 err = ext4_journal_dirty_metadata(handle, sbi->s_sbh); 2046 err = ext4_handle_dirty_metadata(handle, inode, sbi->s_sbh);
2035 } else { 2047 } else {
2036 struct ext4_iloc iloc2; 2048 struct ext4_iloc iloc2;
2037 struct inode *i_prev = 2049 struct inode *i_prev =
2038 &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode; 2050 &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode;
2039 2051
2040 jbd_debug(4, "orphan inode %lu will point to %lu\n", 2052 jbd_debug(4, "orphan inode %lu will point to %u\n",
2041 i_prev->i_ino, ino_next); 2053 i_prev->i_ino, ino_next);
2042 err = ext4_reserve_inode_write(handle, i_prev, &iloc2); 2054 err = ext4_reserve_inode_write(handle, i_prev, &iloc2);
2043 if (err) 2055 if (err)
@@ -2082,7 +2094,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
2082 goto end_rmdir; 2094 goto end_rmdir;
2083 2095
2084 if (IS_DIRSYNC(dir)) 2096 if (IS_DIRSYNC(dir))
2085 handle->h_sync = 1; 2097 ext4_handle_sync(handle);
2086 2098
2087 inode = dentry->d_inode; 2099 inode = dentry->d_inode;
2088 2100
@@ -2136,7 +2148,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2136 return PTR_ERR(handle); 2148 return PTR_ERR(handle);
2137 2149
2138 if (IS_DIRSYNC(dir)) 2150 if (IS_DIRSYNC(dir))
2139 handle->h_sync = 1; 2151 ext4_handle_sync(handle);
2140 2152
2141 retval = -ENOENT; 2153 retval = -ENOENT;
2142 bh = ext4_find_entry(dir, &dentry->d_name, &de); 2154 bh = ext4_find_entry(dir, &dentry->d_name, &de);
@@ -2193,7 +2205,7 @@ retry:
2193 return PTR_ERR(handle); 2205 return PTR_ERR(handle);
2194 2206
2195 if (IS_DIRSYNC(dir)) 2207 if (IS_DIRSYNC(dir))
2196 handle->h_sync = 1; 2208 ext4_handle_sync(handle);
2197 2209
2198 inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO); 2210 inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO);
2199 err = PTR_ERR(inode); 2211 err = PTR_ERR(inode);
@@ -2256,7 +2268,7 @@ retry:
2256 return PTR_ERR(handle); 2268 return PTR_ERR(handle);
2257 2269
2258 if (IS_DIRSYNC(dir)) 2270 if (IS_DIRSYNC(dir))
2259 handle->h_sync = 1; 2271 ext4_handle_sync(handle);
2260 2272
2261 inode->i_ctime = ext4_current_time(inode); 2273 inode->i_ctime = ext4_current_time(inode);
2262 ext4_inc_count(handle, inode); 2274 ext4_inc_count(handle, inode);
@@ -2305,7 +2317,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
2305 return PTR_ERR(handle); 2317 return PTR_ERR(handle);
2306 2318
2307 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir)) 2319 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
2308 handle->h_sync = 1; 2320 ext4_handle_sync(handle);
2309 2321
2310 old_bh = ext4_find_entry(old_dir, &old_dentry->d_name, &old_de); 2322 old_bh = ext4_find_entry(old_dir, &old_dentry->d_name, &old_de);
2311 /* 2323 /*
@@ -2359,8 +2371,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
2359 new_dir->i_ctime = new_dir->i_mtime = 2371 new_dir->i_ctime = new_dir->i_mtime =
2360 ext4_current_time(new_dir); 2372 ext4_current_time(new_dir);
2361 ext4_mark_inode_dirty(handle, new_dir); 2373 ext4_mark_inode_dirty(handle, new_dir);
2362 BUFFER_TRACE(new_bh, "call ext4_journal_dirty_metadata"); 2374 BUFFER_TRACE(new_bh, "call ext4_handle_dirty_metadata");
2363 ext4_journal_dirty_metadata(handle, new_bh); 2375 ext4_handle_dirty_metadata(handle, new_dir, new_bh);
2364 brelse(new_bh); 2376 brelse(new_bh);
2365 new_bh = NULL; 2377 new_bh = NULL;
2366 } 2378 }
@@ -2410,8 +2422,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
2410 BUFFER_TRACE(dir_bh, "get_write_access"); 2422 BUFFER_TRACE(dir_bh, "get_write_access");
2411 ext4_journal_get_write_access(handle, dir_bh); 2423 ext4_journal_get_write_access(handle, dir_bh);
2412 PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); 2424 PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino);
2413 BUFFER_TRACE(dir_bh, "call ext4_journal_dirty_metadata"); 2425 BUFFER_TRACE(dir_bh, "call ext4_handle_dirty_metadata");
2414 ext4_journal_dirty_metadata(handle, dir_bh); 2426 ext4_handle_dirty_metadata(handle, old_dir, dir_bh);
2415 ext4_dec_count(handle, old_dir); 2427 ext4_dec_count(handle, old_dir);
2416 if (new_inode) { 2428 if (new_inode) {
2417 /* checked empty_dir above, can't have another parent, 2429 /* checked empty_dir above, can't have another parent,