Commit 81d1ab82 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  block: fix missing bio back/front segment size setting in blk_recount_segments()
  loop: don't increment p->offset with (size_t) -EINVAL
  cciss: remove 30 second initial timeout on controller reset
  Fix kernel NULL pointer dereference in xen-blkfront
parents d3dea1e2 59247eae
...@@ -39,14 +39,13 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect) ...@@ -39,14 +39,13 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect)
} }
static unsigned int __blk_recalc_rq_segments(struct request_queue *q, static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
struct bio *bio, struct bio *bio)
unsigned int *seg_size_ptr)
{ {
unsigned int phys_size; unsigned int phys_size;
struct bio_vec *bv, *bvprv = NULL; struct bio_vec *bv, *bvprv = NULL;
int cluster, i, high, highprv = 1; int cluster, i, high, highprv = 1;
unsigned int seg_size, nr_phys_segs; unsigned int seg_size, nr_phys_segs;
struct bio *fbio; struct bio *fbio, *bbio;
if (!bio) if (!bio)
return 0; return 0;
...@@ -87,26 +86,20 @@ new_segment: ...@@ -87,26 +86,20 @@ new_segment:
seg_size = bv->bv_len; seg_size = bv->bv_len;
highprv = high; highprv = high;
} }
bbio = bio;
} }
if (seg_size_ptr) if (nr_phys_segs == 1 && seg_size > fbio->bi_seg_front_size)
*seg_size_ptr = seg_size; fbio->bi_seg_front_size = seg_size;
if (seg_size > bbio->bi_seg_back_size)
bbio->bi_seg_back_size = seg_size;
return nr_phys_segs; return nr_phys_segs;
} }
void blk_recalc_rq_segments(struct request *rq) void blk_recalc_rq_segments(struct request *rq)
{ {
unsigned int seg_size = 0, phys_segs; rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio);
phys_segs = __blk_recalc_rq_segments(rq->q, rq->bio, &seg_size);
if (phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
rq->bio->bi_seg_front_size = seg_size;
if (seg_size > rq->biotail->bi_seg_back_size)
rq->biotail->bi_seg_back_size = seg_size;
rq->nr_phys_segments = phys_segs;
} }
void blk_recount_segments(struct request_queue *q, struct bio *bio) void blk_recount_segments(struct request_queue *q, struct bio *bio)
...@@ -114,7 +107,7 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio) ...@@ -114,7 +107,7 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio)
struct bio *nxt = bio->bi_next; struct bio *nxt = bio->bi_next;
bio->bi_next = NULL; bio->bi_next = NULL;
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, NULL); bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);
bio->bi_next = nxt; bio->bi_next = nxt;
bio->bi_flags |= (1 << BIO_SEG_VALID); bio->bi_flags |= (1 << BIO_SEG_VALID);
} }
......
...@@ -3606,11 +3606,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, ...@@ -3606,11 +3606,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev)) if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
return -ENODEV; return -ENODEV;
/* Some devices (notably the HP Smart Array 5i Controller) /* Now try to get the controller to respond to a no-op. Some
need a little pause here */ devices (notably the HP Smart Array 5i Controller) need
schedule_timeout_uninterruptible(30*HZ); up to 30 seconds to respond. */
/* Now try to get the controller to respond to a no-op */
for (i=0; i<30; i++) { for (i=0; i<30; i++) {
if (cciss_noop(pdev) == 0) if (cciss_noop(pdev) == 0)
break; break;
......
...@@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, ...@@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct loop_device *lo = p->lo; struct loop_device *lo = p->lo;
struct page *page = buf->page; struct page *page = buf->page;
sector_t IV; sector_t IV;
size_t size; int size, ret;
int ret;
ret = buf->ops->confirm(pipe, buf); ret = buf->ops->confirm(pipe, buf);
if (unlikely(ret)) if (unlikely(ret))
......
...@@ -977,6 +977,8 @@ static void backend_changed(struct xenbus_device *dev, ...@@ -977,6 +977,8 @@ static void backend_changed(struct xenbus_device *dev,
break; break;
case XenbusStateClosing: case XenbusStateClosing:
if (info->gd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
bd = bdget_disk(info->gd, 0); bd = bdget_disk(info->gd, 0);
if (bd == NULL) if (bd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment