The commit is pushed to "branch-rh9-5.14.0-362.8.1.vz9.35.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-362.8.1.vz9.35.2
------>
commit a184bf61849a3cb65ca8a21340767b7d56269ffc
Author: Yuriy Vasilev <yuriy.vasi...@virtuozzo.com>
Date:   Wed Nov 29 11:12:54 2023 +0100

    fs/fuse kio: introduce try_cslist_get()
    
    This function allows checking if the cslist has been dropped before
    usage.
    
    https://pmc.acronis.work/browse/VSTOR-76384
    
    Signed-off-by: Yuriy Vasilev <yuriy.vasi...@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuz...@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_map.h b/fs/fuse/kio/pcs/pcs_map.h
index cadc106d45c1..b8416712fb69 100644
--- a/fs/fuse/kio/pcs/pcs_map.h
+++ b/fs/fuse/kio/pcs/pcs_map.h
@@ -232,6 +232,18 @@ extern unsigned int cs_enable_fanout;
 
 void cslist_destroy(struct pcs_cs_list * csl);
 
+/* Return:
+ * - true if refcnt incrementation is successful;
+ * - false if refcnt is equal to 0, it indicates that the cslist has been 
dropped
+ *   and it is not safe to use it without acquiring the cs->lock
+ */
+static inline bool try_cslist_get(struct pcs_cs_list *csl)
+{
+       TRACE("csl:%p csl->map:%p refcnt:%d\n", csl, csl->map, 
atomic_read(&csl->refcnt));
+
+       return atomic_inc_not_zero(&csl->refcnt);
+}
+
 static inline void cslist_get(struct pcs_cs_list * csl)
 {
        TRACE("csl:%p csl->map:%p refcnt:%d\n", csl, csl->map, 
atomic_read(&csl->refcnt));
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to