diff options
author | Jerome Marchand <jmarchan@redhat.com> | 2011-01-05 10:57:37 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-01-05 10:57:37 -0500 |
commit | e4a683c899cd5a49f8d684a054c95bd115a0c005 (patch) | |
tree | c7e79e24199a5ed34a488b06cfd3fa890637db7d /include | |
parent | a6e8dc46ff0b7defbfa4f29a71aee263377ec573 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kref.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/kref.h b/include/linux/kref.h index 6cc38fc07ab7..90b9e44abf54 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -23,6 +23,7 @@ struct kref { | |||
23 | 23 | ||
24 | void kref_init(struct kref *kref); | 24 | void kref_init(struct kref *kref); |
25 | void kref_get(struct kref *kref); | 25 | void kref_get(struct kref *kref); |
26 | int kref_test_and_get(struct kref *kref); | ||
26 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); | 27 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); |
27 | 28 | ||
28 | #endif /* _KREF_H_ */ | 29 | #endif /* _KREF_H_ */ |