The function nvram_init() uses sem_lock() and sem_unlock() before/after mount the tmpfs. But just like the annotation that Must get sempahore after NVRAM initialization, mounting will change ID, the locked sempahore and the unlocked sempahore should be different, and could lead to unpredicted side-effect.
Yeah, I think you're right. This code is pretty old and crufty, it'd probably be better to take the IPC key on something in the filesystem that doesn't change instead.
The function
nvram_init()
usessem_lock()
andsem_unlock()
before/after mount the tmpfs. But just like the annotation thatMust get sempahore after NVRAM initialization, mounting will change ID
, the locked sempahore and the unlocked sempahore should be different, and could lead to unpredicted side-effect.