This whole second "slow path" is identical to that in the original lfn_get_name(). You should split it out into a private helper used by both functions for two reasons:
1) It's easier to see clearly that you didn't make any changes to the functionality, so we can tell it works.
2) It leaves us with one copy of the code, instead of two, to fix any bugs in (or make efficiency changes in).