]> git.karo-electronics.de Git - linux-beck.git/commit
kref: add kref_test_and_get
authorJerome Marchand <jmarchan@redhat.com>
Wed, 5 Jan 2011 15:57:37 +0000 (16:57 +0100)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 5 Jan 2011 15:57:37 +0000 (16:57 +0100)
commite4a683c899cd5a49f8d684a054c95bd115a0c005
treec7e79e24199a5ed34a488b06cfd3fa890637db7d
parenta6e8dc46ff0b7defbfa4f29a71aee263377ec573
kref: add kref_test_and_get

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>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
include/linux/kref.h
lib/kref.c