On Sun, Mar 02, 2003 at 03:56:39PM -0500, Haoqiang Zheng wrote: > I don't understand why fput is SMP safe. It calls atomic_dec_and_test(), if > the return value is true, it then directly goes to the clean up section. > But after atomic_dec_and_test() (and before the clean up is done), another > process can still call fget(). I mean, I doesn't see fput acquire any lock > that can prevent fget be executed. Where I am wrong? You need to take into account, that if atomic_dec_and_test decremented to zero, no other pointer to the file exists, so noone can call fget beyond that point. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/