From 51a0bb0c2e614659132fce272c8a1815a12c5c2a Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Wed, 27 Oct 2010 19:51:30 -0600 Subject: [PATCH 1/7] loop: Properly clear sysfs in autoclear mode In autoclear mode bdev is NULL but the sysfs entry should be destroyed otherwise this warning appears: WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x82/0x95() sysfs: cannot create duplicate filename '/devices/virtual/block/loop0/loop' Fixes commit ee86273062cbb310665fe49e1f1937d2cf85b0b9 Signed-off-by: Milan Broz Signed-off-by: Jens Axboe --- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 450c958b514f..1e5284ef65fa 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) if (bdev) invalidate_bdev(bdev); set_capacity(lo->lo_disk, 0); + loop_sysfs_exit(lo); if (bdev) { bd_set_size(bdev, 0); - loop_sysfs_exit(lo); /* let user-space know about this change */ kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE); } From 2027ae1fa914640c287171035cb607a03ad36e95 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 28 Oct 2010 06:15:26 -0600 Subject: [PATCH 2/7] drivers/block/drbd/drbd_main.c: fix error path Failure to create drbd_ee_mempool appears not to get checked. Looks like a copy-and-paste problem to me. Signed-off-by: Nicolas Kaiser Cc: Lars Ellenberg Cc: Philipp Reisner Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index c5dfe6486cf3..25c7a73c5062 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2982,7 +2982,7 @@ static int drbd_create_mempools(void) drbd_ee_mempool = mempool_create(number, mempool_alloc_slab, mempool_free_slab, drbd_ee_cache); - if (drbd_request_mempool == NULL) + if (drbd_ee_mempool == NULL) goto Enomem; /* drbd's page pool */ From 5ad21a337420e82bffb7836ab34027dd7ad624b8 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 28 Oct 2010 06:15:26 -0600 Subject: [PATCH 3/7] aoe: don't use flush_scheduled_work() flush_scheduled_work() is deprecated and scheduled to be removed. Directly cancel aoedev->work on free instead of depending on flush_scheduled_works(). Signed-off-by: Tejun Heo Cc: "Ed L. Cashin" Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/aoe/aoedev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index 0849280bfc1c..6b5110a47458 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c @@ -102,6 +102,7 @@ aoedev_freedev(struct aoedev *d) { struct aoetgt **t, **e; + cancel_work_sync(&d->work); if (d->gd) { aoedisk_rm_sysfs(d); del_gendisk(d->gd); @@ -135,7 +136,6 @@ aoedev_flush(const char __user *str, size_t cnt) all = !strncmp(buf, "all", 3); } - flush_scheduled_work(); spin_lock_irqsave(&devlist_lock, flags); dd = &devlist; while ((d = *dd)) { @@ -257,8 +257,6 @@ aoedev_exit(void) struct aoedev *d; ulong flags; - flush_scheduled_work(); - while ((d = devlist)) { devlist = d->next; From e1fbd9210d5d172f951b1d21eb58383919c4d10d Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 28 Oct 2010 06:15:26 -0600 Subject: [PATCH 4/7] drivers/block/z2ram.c: correct printing of sector_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_LBDAF=y, `sector_t' becomes `u64' instead of `unsigned long': drivers/block/z2ram.c: In function ¡do_z2_request¢: drivers/block/z2ram.c:83: warning: format %lu expects type `long unsigned int', but argument 2 has type `sector_t' Hence always cast it to `unsigned long long' for printing. Also do the pr_err() dance, while we're at it. Signed-off-by: Geert Uytterhoeven Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/z2ram.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index dcd4cfcf4126..a22e3f895947 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c @@ -80,8 +80,10 @@ static void do_z2_request(struct request_queue *q) int err = 0; if (start + len > z2ram_size) { - printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n", - blk_rq_pos(req), blk_rq_cur_sectors(req)); + pr_err(DEVICE_NAME ": bad access: block=%llu, " + "count=%u\n", + (unsigned long long)blk_rq_pos(req), + blk_rq_cur_sectors(req)); err = -EIO; goto done; } From 027b180d7405f2b2df25e2a8b1b796b00f3773cf Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 28 Oct 2010 06:15:26 -0600 Subject: [PATCH 5/7] drivers/block/aoe/aoeblk.c: ratelimit a warning printk As described in https://bugzilla.kernel.org/show_bug.cgi?id=19922 : I had an AoE device go down overnight, and while a server was trying to : write to it, it was also writing this message to its logs: : : 209 printk(KERN_INFO "aoe: device %ld.%d is not up\n", : 210 d->aoemajor, d->aoeminor); : : The message appeared many times per second, and over several hours : produced about 7.5 gigabytes of log files, filling up all free space on : the root filesystem. Cc: "Ed L. Cashin" Suggested-by: Roman Mamedov Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/aoe/aoeblk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index f21c237a9e5e..541e18879965 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c @@ -4,12 +4,14 @@ * block device routines */ +#include #include #include #include #include #include #include +#include #include #include #include @@ -207,7 +209,7 @@ aoeblk_make_request(struct request_queue *q, struct bio *bio) spin_lock_irqsave(&d->lock, flags); if ((d->flags & DEVFL_UP) == 0) { - printk(KERN_INFO "aoe: device %ld.%d is not up\n", + pr_info_ratelimited("aoe: device %ld.%d is not up\n", d->aoemajor, d->aoeminor); spin_unlock_irqrestore(&d->lock, flags); mempool_free(buf, d->bufpool); From 7ab5118d7c2be650bc936894f159dc1c597badae Mon Sep 17 00:00:00 2001 From: Vasiliy Kulikov Date: Thu, 28 Oct 2010 06:31:55 -0600 Subject: [PATCH 6/7] block: cciss: fix information leak to userland Structure IOCTL_Command_struct is copied to userland with some padding fields at the end of the struct unitialized. It leads to leaking of contents of kernel stack memory. Signed-off-by: Vasiliy Kulikov Signed-off-by: Jens Axboe --- drivers/block/cciss.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index f09e6df15aa7..13d87a031c88 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1184,6 +1184,7 @@ static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode, int err; u32 cp; + memset(&arg64, 0, sizeof(arg64)); err = 0; err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, From 6fa977520871b1fc0be64247abad02b678c13fda Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Thu, 28 Oct 2010 06:33:27 -0600 Subject: [PATCH 7/7] cciss: remove overlapping PCI IDs This patch removes the controller overlap between cciss and hpsa. It was decided that no overlap should exist. All new controllers will use the hpsa SCSI based driver. Signed-off-by: Jens Axboe --- drivers/block/cciss.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 13d87a031c88..2cc4dda46279 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -66,11 +66,6 @@ MODULE_VERSION("3.6.26"); MODULE_LICENSE("GPL"); static DEFINE_MUTEX(cciss_mutex); -static int cciss_allow_hpsa; -module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(cciss_allow_hpsa, - "Prevent cciss driver from accessing hardware known to be " - " supported by the hpsa driver"); #include "cciss_cmd.h" #include "cciss.h" @@ -98,19 +93,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3241}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3243}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3350}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3351}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3352}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3353}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3354}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3355}, {0,} }; @@ -138,24 +120,9 @@ static struct board_type products[] = { {0x3214103C, "Smart Array E200i", &SA5_access}, {0x3215103C, "Smart Array E200i", &SA5_access}, {0x3237103C, "Smart Array E500", &SA5_access}, -/* controllers below this line are also supported by the hpsa driver. */ -#define HPSA_BOUNDARY 0x3223103C {0x3223103C, "Smart Array P800", &SA5_access}, {0x3234103C, "Smart Array P400", &SA5_access}, {0x323D103C, "Smart Array P700m", &SA5_access}, - {0x3241103C, "Smart Array P212", &SA5_access}, - {0x3243103C, "Smart Array P410", &SA5_access}, - {0x3245103C, "Smart Array P410i", &SA5_access}, - {0x3247103C, "Smart Array P411", &SA5_access}, - {0x3249103C, "Smart Array P812", &SA5_access}, - {0x324A103C, "Smart Array P712m", &SA5_access}, - {0x324B103C, "Smart Array P711m", &SA5_access}, - {0x3350103C, "Smart Array", &SA5_access}, - {0x3351103C, "Smart Array", &SA5_access}, - {0x3352103C, "Smart Array", &SA5_access}, - {0x3353103C, "Smart Array", &SA5_access}, - {0x3354103C, "Smart Array", &SA5_access}, - {0x3355103C, "Smart Array", &SA5_access}, }; /* How long to wait (in milliseconds) for board to go into simple mode */ @@ -3971,9 +3938,6 @@ static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id) subsystem_vendor_id; for (i = 0; i < ARRAY_SIZE(products); i++) { - /* Stand aside for hpsa driver on request */ - if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY) - return -ENODEV; if (*board_id == products[i].board_id) return i; }