diff options
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r-- | drivers/block/nbd.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 0a1b1ea36ddc..bdbade9a5cf5 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -300,6 +300,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
300 | lo->disk->disk_name, result); | 300 | lo->disk->disk_name, result); |
301 | goto harderror; | 301 | goto harderror; |
302 | } | 302 | } |
303 | |||
304 | if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { | ||
305 | printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", | ||
306 | lo->disk->disk_name, | ||
307 | (unsigned long)ntohl(reply.magic)); | ||
308 | result = -EPROTO; | ||
309 | goto harderror; | ||
310 | } | ||
311 | |||
303 | req = nbd_find_request(lo, reply.handle); | 312 | req = nbd_find_request(lo, reply.handle); |
304 | if (unlikely(IS_ERR(req))) { | 313 | if (unlikely(IS_ERR(req))) { |
305 | result = PTR_ERR(req); | 314 | result = PTR_ERR(req); |
@@ -312,13 +321,6 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
312 | goto harderror; | 321 | goto harderror; |
313 | } | 322 | } |
314 | 323 | ||
315 | if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { | ||
316 | printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", | ||
317 | lo->disk->disk_name, | ||
318 | (unsigned long)ntohl(reply.magic)); | ||
319 | result = -EPROTO; | ||
320 | goto harderror; | ||
321 | } | ||
322 | if (ntohl(reply.error)) { | 324 | if (ntohl(reply.error)) { |
323 | printk(KERN_ERR "%s: Other side returned error (%d)\n", | 325 | printk(KERN_ERR "%s: Other side returned error (%d)\n", |
324 | lo->disk->disk_name, ntohl(reply.error)); | 326 | lo->disk->disk_name, ntohl(reply.error)); |
@@ -339,7 +341,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
339 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", | 341 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", |
340 | lo->disk->disk_name, | 342 | lo->disk->disk_name, |
341 | result); | 343 | result); |
342 | goto harderror; | 344 | req->errors++; |
345 | return req; | ||
343 | } | 346 | } |
344 | dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", | 347 | dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", |
345 | lo->disk->disk_name, req, bvec->bv_len); | 348 | lo->disk->disk_name, req, bvec->bv_len); |