Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: bio: fix memcpy corruption in bio_copy_user_iov() hd: fix locking mg_disk: fix CONFIG_LBD=y warning mg_disk: fix locking
This commit is contained in:
commit
2d04f6b9bc
3 changed files with 24 additions and 15 deletions
|
@ -509,7 +509,6 @@ static void write_intr(void)
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
SET_HANDLER(&write_intr);
|
SET_HANDLER(&write_intr);
|
||||||
outsw(HD_DATA, req->buffer, 256);
|
outsw(HD_DATA, req->buffer, 256);
|
||||||
local_irq_enable();
|
|
||||||
} else {
|
} else {
|
||||||
#if (HD_DELAY > 0)
|
#if (HD_DELAY > 0)
|
||||||
last_req = read_timer();
|
last_req = read_timer();
|
||||||
|
@ -541,8 +540,7 @@ static void hd_times_out(unsigned long dummy)
|
||||||
if (!CURRENT)
|
if (!CURRENT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disable_irq(HD_IRQ);
|
spin_lock_irq(hd_queue->queue_lock);
|
||||||
local_irq_enable();
|
|
||||||
reset = 1;
|
reset = 1;
|
||||||
name = CURRENT->rq_disk->disk_name;
|
name = CURRENT->rq_disk->disk_name;
|
||||||
printk("%s: timeout\n", name);
|
printk("%s: timeout\n", name);
|
||||||
|
@ -552,9 +550,8 @@ static void hd_times_out(unsigned long dummy)
|
||||||
#endif
|
#endif
|
||||||
end_request(CURRENT, 0);
|
end_request(CURRENT, 0);
|
||||||
}
|
}
|
||||||
local_irq_disable();
|
|
||||||
hd_request();
|
hd_request();
|
||||||
enable_irq(HD_IRQ);
|
spin_unlock_irq(hd_queue->queue_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_special_op(struct hd_i_struct *disk, struct request *req)
|
static int do_special_op(struct hd_i_struct *disk, struct request *req)
|
||||||
|
@ -592,7 +589,6 @@ static void hd_request(void)
|
||||||
return;
|
return;
|
||||||
repeat:
|
repeat:
|
||||||
del_timer(&device_timer);
|
del_timer(&device_timer);
|
||||||
local_irq_enable();
|
|
||||||
|
|
||||||
req = CURRENT;
|
req = CURRENT;
|
||||||
if (!req) {
|
if (!req) {
|
||||||
|
@ -601,7 +597,6 @@ static void hd_request(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
local_irq_disable();
|
|
||||||
reset_hd();
|
reset_hd();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,9 +655,7 @@ static void hd_request(void)
|
||||||
|
|
||||||
static void do_hd_request(struct request_queue *q)
|
static void do_hd_request(struct request_queue *q)
|
||||||
{
|
{
|
||||||
disable_irq(HD_IRQ);
|
|
||||||
hd_request();
|
hd_request();
|
||||||
enable_irq(HD_IRQ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
static int hd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||||
|
@ -684,12 +677,16 @@ static irqreturn_t hd_interrupt(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
void (*handler)(void) = do_hd;
|
void (*handler)(void) = do_hd;
|
||||||
|
|
||||||
|
spin_lock(hd_queue->queue_lock);
|
||||||
|
|
||||||
do_hd = NULL;
|
do_hd = NULL;
|
||||||
del_timer(&device_timer);
|
del_timer(&device_timer);
|
||||||
if (!handler)
|
if (!handler)
|
||||||
handler = unexpected_hd_interrupt;
|
handler = unexpected_hd_interrupt;
|
||||||
handler();
|
handler();
|
||||||
local_irq_enable();
|
|
||||||
|
spin_unlock(hd_queue->queue_lock);
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void mg_dump_status(const char *msg, unsigned int stat,
|
||||||
if (host->breq) {
|
if (host->breq) {
|
||||||
req = elv_next_request(host->breq);
|
req = elv_next_request(host->breq);
|
||||||
if (req)
|
if (req)
|
||||||
printk(", sector=%ld", req->sector);
|
printk(", sector=%u", (u32)req->sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,16 @@ static irqreturn_t mg_irq(int irq, void *dev_id)
|
||||||
struct mg_host *host = dev_id;
|
struct mg_host *host = dev_id;
|
||||||
void (*handler)(struct mg_host *) = host->mg_do_intr;
|
void (*handler)(struct mg_host *) = host->mg_do_intr;
|
||||||
|
|
||||||
host->mg_do_intr = 0;
|
spin_lock(&host->lock);
|
||||||
|
|
||||||
|
host->mg_do_intr = NULL;
|
||||||
del_timer(&host->timer);
|
del_timer(&host->timer);
|
||||||
if (!handler)
|
if (!handler)
|
||||||
handler = mg_unexpected_intr;
|
handler = mg_unexpected_intr;
|
||||||
handler(host);
|
handler(host);
|
||||||
|
|
||||||
|
spin_unlock(&host->lock);
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +324,7 @@ static void mg_read(struct request *req)
|
||||||
|
|
||||||
remains = req->nr_sectors;
|
remains = req->nr_sectors;
|
||||||
|
|
||||||
if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_RD, 0) !=
|
if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_RD, NULL) !=
|
||||||
MG_ERR_NONE)
|
MG_ERR_NONE)
|
||||||
mg_bad_rw_intr(host);
|
mg_bad_rw_intr(host);
|
||||||
|
|
||||||
|
@ -363,7 +368,7 @@ static void mg_write(struct request *req)
|
||||||
|
|
||||||
remains = req->nr_sectors;
|
remains = req->nr_sectors;
|
||||||
|
|
||||||
if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_WR, 0) !=
|
if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_WR, NULL) !=
|
||||||
MG_ERR_NONE) {
|
MG_ERR_NONE) {
|
||||||
mg_bad_rw_intr(host);
|
mg_bad_rw_intr(host);
|
||||||
return;
|
return;
|
||||||
|
@ -521,9 +526,11 @@ void mg_times_out(unsigned long data)
|
||||||
char *name;
|
char *name;
|
||||||
struct request *req;
|
struct request *req;
|
||||||
|
|
||||||
|
spin_lock_irq(&host->lock);
|
||||||
|
|
||||||
req = elv_next_request(host->breq);
|
req = elv_next_request(host->breq);
|
||||||
if (!req)
|
if (!req)
|
||||||
return;
|
goto out_unlock;
|
||||||
|
|
||||||
host->mg_do_intr = NULL;
|
host->mg_do_intr = NULL;
|
||||||
|
|
||||||
|
@ -534,6 +541,8 @@ void mg_times_out(unsigned long data)
|
||||||
mg_bad_rw_intr(host);
|
mg_bad_rw_intr(host);
|
||||||
|
|
||||||
mg_request(host->breq);
|
mg_request(host->breq);
|
||||||
|
out_unlock:
|
||||||
|
spin_unlock_irq(&host->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mg_request_poll(struct request_queue *q)
|
static void mg_request_poll(struct request_queue *q)
|
||||||
|
|
3
fs/bio.c
3
fs/bio.c
|
@ -817,6 +817,9 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
|
||||||
len += iov[i].iov_len;
|
len += iov[i].iov_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (offset)
|
||||||
|
nr_pages++;
|
||||||
|
|
||||||
bmd = bio_alloc_map_data(nr_pages, iov_count, gfp_mask);
|
bmd = bio_alloc_map_data(nr_pages, iov_count, gfp_mask);
|
||||||
if (!bmd)
|
if (!bmd)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
Loading…
Reference in a new issue