aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/namei.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index a13948f8242f..608d21f873ec 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2013,6 +2013,13 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
2013 err = ext4_reserve_inode_write(handle, inode, &iloc); 2013 err = ext4_reserve_inode_write(handle, inode, &iloc);
2014 if (err) 2014 if (err)
2015 goto out_unlock; 2015 goto out_unlock;
2016 /*
2017 * Due to previous errors inode may be already a part of on-disk
2018 * orphan list. If so skip on-disk list modification.
2019 */
2020 if (NEXT_ORPHAN(inode) && NEXT_ORPHAN(inode) <=
2021 (le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)))
2022 goto mem_insert;
2016 2023
2017 /* Insert this inode at the head of the on-disk orphan list... */ 2024 /* Insert this inode at the head of the on-disk orphan list... */
2018 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan); 2025 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
@@ -2030,6 +2037,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
2030 * 2037 *
2031 * This is safe: on error we're going to ignore the orphan list 2038 * This is safe: on error we're going to ignore the orphan list
2032 * anyway on the next recovery. */ 2039 * anyway on the next recovery. */
2040mem_insert:
2033 if (!err) 2041 if (!err)
2034 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); 2042 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
2035 2043