aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-07-16 02:41:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:50 -0400
commitbe0ef957c9eed4ebae873ee3fbcfb9dfde486dec (patch)
treedb0f0f9b029c2fbaddf74de0417658ae35bf6c5c
parent3e1ac130d08b0c7066615fe60fe1e7212c8eaf6a (diff)
nbd.c: sock_xmit: cleanup signal related code
sock_xmit() re-implements sigprocmask() and dequeue_signal_lock(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Paul Clements <paul.clements@steeleye.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/block/nbd.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c575fb1d585f..c12951024090 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(&current->sighand->siglock, flags); 129 siginitsetinv(&blocked, sigmask(SIGKILL));
131 oldset = current->blocked; 130 sigprocmask(SIG_SETMASK, &blocked, &oldset);
132 sigfillset(&current->blocked);
133 sigdelsetmask(&current->blocked, sigmask(SIGKILL));
134 recalc_sigpending();
135 spin_unlock_irqrestore(&current->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(&current->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, &current->blocked, &info)); 151 dequeue_signal_lock(current, &current->blocked, &info));
158 spin_unlock_irqrestore(&current->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(&current->sighand->siglock, flags); 165 sigprocmask(SIG_SETMASK, &oldset, NULL);
173 current->blocked = oldset;
174 recalc_sigpending();
175 spin_unlock_irqrestore(&current->sighand->siglock, flags);
176 166
177 return result; 167 return result;
178} 168}