104{
105 int error = req->errors ? -EIO : 0;
106 struct request_queue *q = req->q;
107 unsigned long flags;
108
109 dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name,
110 req, error ? "failed" : "done");
111
112 spin_lock_irqsave(q->queue_lock, flags);
113 __blk_end_request(req, error, req->nr_sectors << 9);
114 spin_unlock_irqrestore(q->queue_lock, flags);
115}
116
117static void sock_shutdown(struct nbd_device *lo, int lock)
118{
119
120
121
122
123
124
125 if (lock)
126 mutex_lock(&lo->tx_lock);
127 if (lo->sock) {
128 printk(KERN_WARNING "%s: shutting down socket\n",
129 lo->disk->disk_name);
130 kernel_sock_shutdown(lo->sock, SHUT_RDWR);
131 lo->sock = NULL;
132 }
133 if (lock)
134 mutex_unlock(&lo->tx_lock);
135}
136
137static void nbd_xmit_timeout(unsigned long arg)
138{
139 struct task_struct *task = (struct task_struct *)arg;
140
141 printk(KERN_WARNING "nbd: killing hung xmit (%s, pid: %d)\n",
142 task->comm, task->pid);
143 force_sig(SIGKILL, task);
144}