#define LNET_ACCEPTOR_MIN_RESERVED_PORT 512
#define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023
-/* Block all signals except for the @sigs */
-static inline void cfs_block_sigsinv(unsigned long sigs, sigset_t *old)
-{
- sigset_t new;
-
- siginitsetinv(&new, sigs);
- sigorsets(&new, ¤t->blocked, &new);
- sigprocmask(SIG_BLOCK, &new, old);
-}
-
-static inline void
-cfs_restore_sigs(sigset_t *old)
-{
- sigprocmask(SIG_SETMASK, old, NULL);
-}
-
struct libcfs_ioctl_handler {
struct list_head item;
int (*handle_ioctl)(unsigned int cmd, struct libcfs_ioctl_hdr *hdr);
*/
#define l_wait_event_abortable(wq, condition) \
({ \
- sigset_t __old_blocked; \
+ sigset_t __new_blocked, __old_blocked; \
int __ret = 0; \
- cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
+ siginitset(&__new_blocked, LUSTRE_FATAL_SIGS); \
+ sigprocmask(SIG_BLOCK, &__new_blocked, &__old_blocked); \
__ret = wait_event_interruptible(wq, condition); \
- cfs_restore_sigs(&__old_blocked); \
+ sigprocmask(SIG_SETMASK, &__old_blocked, NULL); \
__ret; \
})
#define l_wait_event_abortable_timeout(wq, condition, timeout) \
({ \
- sigset_t __old_blocked; \
+ sigset_t __new_blocked, __old_blocked; \
int __ret = 0; \
- cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
+ siginitset(&__new_blocked, LUSTRE_FATAL_SIGS); \
+ sigprocmask(SIG_BLOCK, &__new_blocked, &__old_blocked); \
__ret = wait_event_interruptible_timeout(wq, condition, timeout);\
- cfs_restore_sigs(&__old_blocked); \
+ sigprocmask(SIG_SETMASK, &__old_blocked, NULL); \
__ret; \
})
#define l_wait_event_abortable_exclusive(wq, condition) \
({ \
- sigset_t __old_blocked; \
+ sigset_t __new_blocked, __old_blocked; \
int __ret = 0; \
- cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
+ siginitset(&__new_blocked, LUSTRE_FATAL_SIGS); \
+ sigprocmask(SIG_BLOCK, &__new_blocked, &__old_blocked); \
__ret = wait_event_interruptible_exclusive(wq, condition); \
- cfs_restore_sigs(&__old_blocked); \
+ sigprocmask(SIG_SETMASK, &__old_blocked, NULL); \
__ret; \
})
#endif /* _LUSTRE_LIB_H */
struct vvp_io *vio;
int result;
u16 refcheck;
- sigset_t set;
+ sigset_t old, new;
struct inode *inode;
struct ll_inode_info *lli;
vio->u.fault.ft_vma = vma;
vio->u.fault.ft_vmpage = vmpage;
- cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM), &set);
+ siginitsetinv(&new, sigmask(SIGKILL) | sigmask(SIGTERM));
+ sigprocmask(SIG_BLOCK, &new, &old);
inode = vvp_object_inode(io->ci_obj);
lli = ll_i2info(inode);
result = cl_io_loop(env, io);
- cfs_restore_sigs(&set);
+ sigprocmask(SIG_SETMASK, &old, NULL);
if (result == 0) {
struct inode *inode = file_inode(vma->vm_file);
int count = 0;
bool printed = false;
int result;
- sigset_t set;
+ sigset_t old, new;
/* Only SIGKILL and SIGTERM are allowed for fault/nopage/mkwrite
* so that it can be killed by admin but not cause segfault by
* other signals.
*/
- cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM), &set);
+ siginitsetinv(&new, sigmask(SIGKILL) | sigmask(SIGTERM));
+ sigprocmask(SIG_BLOCK, &new, &old);
restart:
result = ll_fault0(vmf->vma, vmf);
result = VM_FAULT_LOCKED;
}
- cfs_restore_sigs(&set);
+ sigprocmask(SIG_SETMASK, &old, NULL);
return result;
}