/*
* Defined by platform
*/
-sigset_t cfs_block_sigsinv(unsigned long sigs);
-void cfs_restore_sigs(sigset_t sigset);
+void cfs_block_sigsinv(unsigned long sigs, sigset_t *sigset);
+void cfs_restore_sigs(sigset_t *sigset);
struct libcfs_ioctl_handler {
struct list_head item;
#endif
/* Block all signals except for the @sigs */
-sigset_t cfs_block_sigsinv(unsigned long sigs)
+void cfs_block_sigsinv(unsigned long sigs, sigset_t *old)
{
- unsigned long flags;
- sigset_t old;
+ sigset_t new;
- spin_lock_irqsave(¤t->sighand->siglock, flags);
- old = current->blocked;
- sigaddsetmask(¤t->blocked, ~sigs);
- recalc_sigpending();
- spin_unlock_irqrestore(¤t->sighand->siglock, flags);
-
- return old;
+ siginitsetinv(&new, sigs);
+ sigorsets(&new, ¤t->blocked, &new);
+ sigprocmask(SIG_BLOCK, &new, old);
}
EXPORT_SYMBOL(cfs_block_sigsinv);
void
-cfs_restore_sigs(sigset_t old)
+cfs_restore_sigs(sigset_t *old)
{
- unsigned long flags;
-
- spin_lock_irqsave(¤t->sighand->siglock, flags);
- current->blocked = old;
- recalc_sigpending();
- spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ sigprocmask(SIG_SETMASK, old, NULL);
}
EXPORT_SYMBOL(cfs_restore_sigs);
*/
#define l_wait_event_abortable(wq, condition) \
({ \
- sigset_t __blocked; \
+ sigset_t __old_blocked; \
int __ret = 0; \
- __blocked = cfs_block_sigsinv(LUSTRE_FATAL_SIGS); \
+ cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
__ret = wait_event_interruptible(wq, condition); \
- cfs_restore_sigs(__blocked); \
+ cfs_restore_sigs(&__old_blocked); \
__ret; \
})
#define l_wait_event_abortable_timeout(wq, condition, timeout) \
({ \
- sigset_t __blocked; \
+ sigset_t __old_blocked; \
int __ret = 0; \
- __blocked = cfs_block_sigsinv(LUSTRE_FATAL_SIGS); \
+ cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
__ret = wait_event_interruptible_timeout(wq, condition, timeout);\
- cfs_restore_sigs(__blocked); \
+ cfs_restore_sigs(&__old_blocked); \
__ret; \
})
#define l_wait_event_abortable_exclusive(wq, condition) \
({ \
- sigset_t __blocked; \
+ sigset_t __old_blocked; \
int __ret = 0; \
- __blocked = cfs_block_sigsinv(LUSTRE_FATAL_SIGS); \
+ cfs_block_sigsinv(LUSTRE_FATAL_SIGS, &__old_blocked); \
__ret = wait_event_interruptible_exclusive(wq, condition); \
- cfs_restore_sigs(__blocked); \
+ cfs_restore_sigs(&__old_blocked); \
__ret; \
})
#endif /* _LUSTRE_LIB_H */
vio->u.fault.ft_vma = vma;
vio->u.fault.ft_vmpage = vmpage;
- set = cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM));
+ cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM), &set);
inode = vvp_object_inode(io->ci_obj);
lli = ll_i2info(inode);
result = cl_io_loop(env, io);
- cfs_restore_sigs(set);
+ cfs_restore_sigs(&set);
if (result == 0) {
struct inode *inode = file_inode(vma->vm_file);
* so that it can be killed by admin but not cause segfault by
* other signals.
*/
- set = cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM));
+ cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM), &set);
restart:
result = ll_fault0(vmf->vma, vmf);
result = VM_FAULT_LOCKED;
}
- cfs_restore_sigs(set);
+ cfs_restore_sigs(&set);
return result;
}