The way you wrote it there is a use-after-free because other_flag is not valid anymore immediately after the previous holder exits. Instead you spin on your own flag (which the holder sets to true when releasing the lock).
The correct code requires the local atomic to be a pointer to struct, containing both a pointer to the next link and the "still locked" flag. Alternatively, the locked flag can be snuck into the low bit of the pointer.