]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kref: add kref_test_and_get
authorJerome Marchand <jmarchan@redhat.com>
Wed, 5 Jan 2011 15:57:37 +0000 (16:57 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 23:14:17 +0000 (15:14 -0800)
commit07384b42b672c8ea266ea4ba50c5e50c9323ae9f
tree6dd77da4aa14e5e090c89c75f3625e22c87ee74b
parentc4b03cd47360e5eb751adf2a5f96e7edcfde9821
kref: add kref_test_and_get

commit e4a683c899cd5a49f8d684a054c95bd115a0c005 upstream.

Add kref_test_and_get() function, which atomically add a reference only if
refcount is not zero. This prevent to add a reference to an object that is
already being removed.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/linux/kref.h
lib/kref.c