1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38#ifndef _LUSTRE_LIB_H
39#define _LUSTRE_LIB_H
40
41
42
43
44
45
46#include <linux/sched/signal.h>
47#include <linux/signal.h>
48#include <linux/types.h>
49#include <linux/libcfs/libcfs.h>
50#include <uapi/linux/lustre/lustre_idl.h>
51#include <uapi/linux/lustre/lustre_ver.h>
52#include <uapi/linux/lustre/lustre_cfg.h>
53
54
55struct ptlrpc_request;
56struct obd_export;
57struct lu_target;
58struct l_wait_info;
59#include <lustre_ha.h>
60#include <lustre_net.h>
61
62#define LI_POISON 0x5a5a5a5a
63#if BITS_PER_LONG > 32
64# define LL_POISON 0x5a5a5a5a5a5a5a5aL
65#else
66# define LL_POISON 0x5a5a5a5aL
67#endif
68#define LP_POISON ((void *)LL_POISON)
69
70int target_pack_pool_reply(struct ptlrpc_request *req);
71int do_set_info_async(struct obd_import *imp,
72 int opcode, int version,
73 u32 keylen, void *key,
74 u32 vallen, void *val,
75 struct ptlrpc_request_set *set);
76
77void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
78
79#define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | \
80 sigmask(SIGTERM) | sigmask(SIGQUIT) | \
81 sigmask(SIGALRM))
82static inline int l_fatal_signal_pending(struct task_struct *p)
83{
84 return signal_pending(p) && sigtestsetmask(&p->pending.signal, LUSTRE_FATAL_SIGS);
85}
86
87
88
89
90
91
92
93
94
95#define l_wait_event_abortable(wq, condition) \
96({ \
97 sigset_t __old_blocked; \
98 int __ret = 0; \
99 cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
100 __ret = wait_event_interruptible(wq, condition); \
101 cfs_restore_sigs(&__old_blocked); \
102 __ret; \
103})
104
105#define l_wait_event_abortable_timeout(wq, condition, timeout) \
106({ \
107 sigset_t __old_blocked; \
108 int __ret = 0; \
109 cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
110 __ret = wait_event_interruptible_timeout(wq, condition, timeout);\
111 cfs_restore_sigs(&__old_blocked); \
112 __ret; \
113})
114
115#define l_wait_event_abortable_exclusive(wq, condition) \
116({ \
117 sigset_t __old_blocked; \
118 int __ret = 0; \
119 cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
120 __ret = wait_event_interruptible_exclusive(wq, condition); \
121 cfs_restore_sigs(&__old_blocked); \
122 __ret; \
123})
124#endif
125