XArray: Add wrappers for nested spinlocks
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 17 Jan 2020 17:36:32 +0000 (12:36 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 18 Jan 2020 03:32:17 +0000 (22:32 -0500)
Some users need to take an xarray lock while holding another xarray lock.

Reported-by: Doug Gilbert <dgilbert@interlog.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/linux/xarray.h

index 86eecbd..736afd3 100644 (file)
@@ -508,6 +508,14 @@ static inline bool xa_marked(const struct xarray *xa, xa_mark_t mark)
                                spin_lock_irqsave(&(xa)->xa_lock, flags)
 #define xa_unlock_irqrestore(xa, flags) \
                                spin_unlock_irqrestore(&(xa)->xa_lock, flags)
+#define xa_lock_nested(xa, subclass) \
+                               spin_lock_nested(&(xa)->xa_lock, subclass)
+#define xa_lock_bh_nested(xa, subclass) \
+                               spin_lock_bh_nested(&(xa)->xa_lock, subclass)
+#define xa_lock_irq_nested(xa, subclass) \
+                               spin_lock_irq_nested(&(xa)->xa_lock, subclass)
+#define xa_lock_irqsave_nested(xa, flags, subclass) \
+               spin_lock_irqsave_nested(&(xa)->xa_lock, flags, subclass)
 
 /*
  * Versions of the normal API which require the caller to hold the