Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: introduce DLM_LSFL_SOFTIRQ_SAFE

Introduce a new external lockspace flag DLM_LSFL_SOFTIRQ_SAFE. A
lockspace user will set this flag if it can handle dlm running the
callback functions from softirq context. When not set, dlm will
continue to run callback functions from the dlm_callback workqueue.
The new lockspace flag cannot be used for user space lockspaces, so
a uapi placeholder definition is used for the new flag value.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Alexander Aring and committed by
David Teigland
f328a26e d3d85e9a

+21 -1
+3
fs/dlm/lockspace.c
··· 629 629 void *ops_arg, int *ops_result, 630 630 dlm_lockspace_t **lockspace) 631 631 { 632 + if (flags & DLM_LSFL_SOFTIRQ) 633 + return -EINVAL; 634 + 632 635 return __dlm_new_lockspace(name, cluster, flags, lvblen, ops, 633 636 ops_arg, ops_result, lockspace); 634 637 }
+16 -1
include/linux/dlm.h
··· 35 35 int num_slots, int our_slot, uint32_t generation); 36 36 }; 37 37 38 + /* only relevant for kernel lockspaces, will be removed in future */ 39 + #define DLM_LSFL_SOFTIRQ __DLM_LSFL_RESERVED0 40 + 38 41 /* 39 42 * dlm_new_lockspace 40 43 * ··· 58 55 * used to select the directory node. Must be the same on all nodes. 59 56 * DLM_LSFL_NEWEXCL 60 57 * dlm_new_lockspace() should return -EEXIST if the lockspace exists. 58 + * DLM_LSFL_SOFTIRQ 59 + * dlm request callbacks (ast, bast) are softirq safe. Flag should be 60 + * preferred by users. Will be default in some future. If set the 61 + * strongest context for ast, bast callback is softirq as it avoids 62 + * an additional context switch. 61 63 * 62 64 * lvblen: length of lvb in bytes. Must be multiple of 8. 63 65 * dlm_new_lockspace() returns an error if this does not match ··· 129 121 * call. 130 122 * 131 123 * AST routines should not block (at least not for long), but may make 132 - * any locking calls they please. 124 + * any locking calls they please. If DLM_LSFL_SOFTIRQ for kernel 125 + * users of dlm_new_lockspace() is passed the ast and bast callbacks 126 + * can be processed in softirq context. Also some of the callback 127 + * contexts are in the same context as the DLM lock request API, users 128 + * must not hold locks while calling dlm lock request API and trying 129 + * to acquire this lock in the callback again, this will end in a 130 + * lock recursion. For newer implementation the DLM_LSFL_SOFTIRQ 131 + * should be used. 133 132 */ 134 133 135 134 int dlm_lock(dlm_lockspace_t *lockspace,
+2
include/uapi/linux/dlm.h
··· 71 71 /* DLM_LSFL_TIMEWARN is deprecated and reserved. DO NOT USE! */ 72 72 #define DLM_LSFL_TIMEWARN 0x00000002 73 73 #define DLM_LSFL_NEWEXCL 0x00000008 74 + /* currently reserved due in-kernel use */ 75 + #define __DLM_LSFL_RESERVED0 0x00000010 74 76 75 77 76 78 #endif /* _UAPI__DLM_DOT_H__ */