From: Anatol Pomozov Date: Tue, 18 Sep 2012 17:38:59 +0000 (-0400) Subject: ext4: make orphan functions be no-op in no-journal mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=608194a40b8f76576d538f6e8379261ea92eb2e7;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git ext4: make orphan functions be no-op in no-journal mode Instead of checking whether the handle is valid, we check if journal is enabled. This avoids taking the s_orphan_lock mutex in all cases when there is no journal in use, including the error paths where ext4_orphan_del() is called with a handle set to NULL. Signed-off-by: Anatol Pomozov Signed-off-by: "Theodore Ts'o" Conflicts: fs/ext4/namei.c Change-Id: I734ccb8069fceb12b864e7b9dceb37e27ab94c61 --- diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index dadeef4422d..7588fdeed7d 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2622,7 +2622,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) struct ext4_iloc iloc; int err = 0, rc; - if (!EXT4_SB(sb)->s_journal) + if (!EXT4_SB(sb)->s_journal || is_bad_inode(inode)) return 0; mutex_lock(&EXT4_SB(sb)->s_orphan_lock); @@ -2696,7 +2696,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) struct ext4_iloc iloc; int err = 0; - if ((!EXT4_SB(inode->i_sb)->s_journal) && + if (!EXT4_SB(inode->i_sb)->s_journal && !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) return 0;