Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: rearrange general fastpath check now that O_CREAT uses it

If we find a positive dentry we can now simply try and open it. All
prelimiary checks are already done with or without O_CREAT.

Signed-off-by: Christian Brauner <brauner@kernel.org>

+4 -13
+4 -13
fs/namei.c
··· 3666 3666 if (IS_ERR(dentry)) 3667 3667 return ERR_CAST(dentry); 3668 3668 3669 - if (!(open_flag & O_CREAT)) { 3670 - if (likely(dentry)) 3671 - goto finish_lookup; 3669 + if (likely(dentry)) 3670 + goto finish_lookup; 3672 3671 3672 + if (!(open_flag & O_CREAT)) { 3673 3673 if (WARN_ON_ONCE(nd->flags & LOOKUP_RCU)) 3674 3674 return ERR_PTR(-ECHILD); 3675 3675 } else { 3676 3676 if (nd->flags & LOOKUP_RCU) { 3677 - bool unlazied; 3678 - 3679 - /* can stay in rcuwalk if not auditing */ 3680 - if (dentry) 3681 - goto finish_lookup; 3682 - unlazied = dentry ? try_to_unlazy_next(nd, dentry) : 3683 - try_to_unlazy(nd); 3684 - if (!unlazied) 3677 + if (!try_to_unlazy(nd)) 3685 3678 return ERR_PTR(-ECHILD); 3686 3679 } 3687 - if (dentry) 3688 - goto finish_lookup; 3689 3680 } 3690 3681 3691 3682 if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {