diff options
| -rw-r--r-- | drivers/block/nbd.c | 22 | 
1 files changed, 6 insertions, 16 deletions
| diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index c575fb1d585..c1295102409 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -122,17 +122,12 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
| 122 | int result; | 122 | int result; | 
| 123 | struct msghdr msg; | 123 | struct msghdr msg; | 
| 124 | struct kvec iov; | 124 | struct kvec iov; | 
| 125 | unsigned long flags; | 125 | sigset_t blocked, oldset; | 
| 126 | sigset_t oldset; | ||
| 127 | 126 | ||
| 128 | /* Allow interception of SIGKILL only | 127 | /* Allow interception of SIGKILL only | 
| 129 | * Don't allow other signals to interrupt the transmission */ | 128 | * Don't allow other signals to interrupt the transmission */ | 
| 130 | spin_lock_irqsave(¤t->sighand->siglock, flags); | 129 | siginitsetinv(&blocked, sigmask(SIGKILL)); | 
| 131 | oldset = current->blocked; | 130 | sigprocmask(SIG_SETMASK, &blocked, &oldset); | 
| 132 | sigfillset(¤t->blocked); | ||
| 133 | sigdelsetmask(¤t->blocked, sigmask(SIGKILL)); | ||
| 134 | recalc_sigpending(); | ||
| 135 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); | ||
| 136 | 131 | ||
| 137 | do { | 132 | do { | 
| 138 | sock->sk->sk_allocation = GFP_NOIO; | 133 | sock->sk->sk_allocation = GFP_NOIO; | 
| @@ -151,11 +146,9 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
| 151 | 146 | ||
| 152 | if (signal_pending(current)) { | 147 | if (signal_pending(current)) { | 
| 153 | siginfo_t info; | 148 | siginfo_t info; | 
| 154 | spin_lock_irqsave(¤t->sighand->siglock, flags); | ||
| 155 | printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n", | 149 | printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n", | 
| 156 | current->pid, current->comm, | 150 | current->pid, current->comm, | 
| 157 | dequeue_signal(current, ¤t->blocked, &info)); | 151 | dequeue_signal_lock(current, ¤t->blocked, &info)); | 
| 158 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); | ||
| 159 | result = -EINTR; | 152 | result = -EINTR; | 
| 160 | break; | 153 | break; | 
| 161 | } | 154 | } | 
| @@ -169,10 +162,7 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
| 169 | buf += result; | 162 | buf += result; | 
| 170 | } while (size > 0); | 163 | } while (size > 0); | 
| 171 | 164 | ||
| 172 | spin_lock_irqsave(¤t->sighand->siglock, flags); | 165 | sigprocmask(SIG_SETMASK, &oldset, NULL); | 
| 173 | current->blocked = oldset; | ||
| 174 | recalc_sigpending(); | ||
| 175 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); | ||
| 176 | 166 | ||
| 177 | return result; | 167 | return result; | 
| 178 | } | 168 | } | 
