Skip to content

Commit 4476c0e

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block driver update from Jens Axboe: "Distilled down variant, the rest will pass over to 3.8. I pulled it into the for-linus branch I had waiting for a pull request as well, in case you are wondering why there are new entries in here too. This also got rid of two reverts and the ones of the mtip32xx patches that went in later in the 3.6 cycle, so the series looks a bit cleaner." * 'for-linus' of git://git.kernel.dk/linux-block: loop: Make explicit loop device destruction lazy mtip32xx:Added appropriate timeout value for secure erase xen/blkback: Change xen_vbd's flush_support and discard_secure to have type unsigned int, rather than bool cciss: select CONFIG_CHECK_SIGNATURE cciss: remove unneeded memset() xen/blkback: use kmem_cache_zalloc instead of kmem_cache_alloc/memset pktcdvd: update MAINTAINERS floppy: remove dr, reuse drive on do_floppy_init floppy: use common function to check if floppies can be registered floppy: properly handle failure on add_disk loop floppy: do put_disk on current dr if blk_init_queue fails floppy: don't call alloc_ordered_workqueue inside the alloc_disk loop xen/blkback: Fix compile warning block: Add blk_rq_pos(rq) to sort rq when plushing drivers/block: remove CONFIG_EXPERIMENTAL block: remove CONFIG_EXPERIMENTAL vfs: fix: don't increase bio_slab_max if krealloc() fails blkcg: stop iteration early if root_rl is the only request list blkcg: Fix use-after-free of q->root_blkg and q->root_rl.blkg
2 parents 35fd3dc + a1ecac3 commit 4476c0e

File tree

13 files changed

+113
-68
lines changed

13 files changed

+113
-68
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5647,7 +5647,7 @@ S: Maintained
56475647
F: drivers/pinctrl/spear/
56485648

56495649
PKTCDVD DRIVER
5650-
M: Peter Osterlund <petero2@telia.com>
5650+
M: Jiri Kosina <jkosina@suse.cz>
56515651
S: Maintained
56525652
F: drivers/block/pktcdvd.c
56535653
F: include/linux/pktcdvd.h

block/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ config BLK_DEV_INTEGRITY
8989

9090
config BLK_DEV_THROTTLING
9191
bool "Block layer bio throttling support"
92-
depends on BLK_CGROUP=y && EXPERIMENTAL
92+
depends on BLK_CGROUP=y
9393
default n
9494
---help---
9595
Block layer bio throttling support. It can be used to limit

block/blk-cgroup.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,13 @@ static void blkg_destroy_all(struct request_queue *q)
285285
blkg_destroy(blkg);
286286
spin_unlock(&blkcg->lock);
287287
}
288+
289+
/*
290+
* root blkg is destroyed. Just clear the pointer since
291+
* root_rl does not take reference on root blkg.
292+
*/
293+
q->root_blkg = NULL;
294+
q->root_rl.blkg = NULL;
288295
}
289296

290297
static void blkg_rcu_free(struct rcu_head *rcu_head)
@@ -326,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl,
326333
*/
327334
if (rl == &q->root_rl) {
328335
ent = &q->blkg_list;
336+
/* There are no more block groups, hence no request lists */
337+
if (list_empty(ent))
338+
return NULL;
329339
} else {
330340
blkg = container_of(rl, struct blkcg_gq, rl);
331341
ent = &blkg->q_node;

block/blk-core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,8 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
28682868
struct request *rqa = container_of(a, struct request, queuelist);
28692869
struct request *rqb = container_of(b, struct request, queuelist);
28702870

2871-
return !(rqa->q <= rqb->q);
2871+
return !(rqa->q < rqb->q ||
2872+
(rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb)));
28722873
}
28732874

28742875
/*

drivers/block/Kconfig

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ config BLK_CPQ_DA
131131
config BLK_CPQ_CISS_DA
132132
tristate "Compaq Smart Array 5xxx support"
133133
depends on PCI
134+
select CHECK_SIGNATURE
134135
help
135136
This is the driver for Compaq Smart Array 5xxx controllers.
136137
Everyone using these boards should say Y here.
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960
166167
module will be called DAC960.
167168

168169
config BLK_DEV_UMEM
169-
tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)"
170-
depends on PCI && EXPERIMENTAL
170+
tristate "Micro Memory MM5415 Battery Backed RAM support"
171+
depends on PCI
171172
---help---
172173
Saying Y here will include support for the MM5415 family of
173174
battery backed (Non-volatile) RAM cards.
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS
430431
a disc is opened for writing.
431432

432433
config CDROM_PKTCDVD_WCACHE
433-
bool "Enable write caching (EXPERIMENTAL)"
434-
depends on CDROM_PKTCDVD && EXPERIMENTAL
434+
bool "Enable write caching"
435+
depends on CDROM_PKTCDVD
435436
help
436437
If enabled, write caching will be set for the CD-R/W device. For now
437438
this option is dangerous unless the CD-RW media is known good, as we
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND
508509

509510

510511
config VIRTIO_BLK
511-
tristate "Virtio block driver (EXPERIMENTAL)"
512-
depends on EXPERIMENTAL && VIRTIO
512+
tristate "Virtio block driver"
513+
depends on VIRTIO
513514
---help---
514515
This is the virtual block driver for virtio. It can be used with
515516
lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.
@@ -528,7 +529,7 @@ config BLK_DEV_HD
528529

529530
config BLK_DEV_RBD
530531
tristate "Rados block device (RBD)"
531-
depends on INET && EXPERIMENTAL && BLOCK
532+
depends on INET && BLOCK
532533
select CEPH_LIB
533534
select LIBCRC32C
534535
select CRYPTO_AES

drivers/block/cciss.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev)
52055205
return;
52065206
}
52075207
/* write all data in the battery backed cache to disk */
5208-
memset(flush_buf, 0, 4);
52095208
return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf,
52105209
4, 0, CTLR_LUNID, TYPE_CMD);
52115210
kfree(flush_buf);

drivers/block/floppy.c

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = {
41094109

41104110
static struct platform_device floppy_device[N_DRIVE];
41114111

4112+
static bool floppy_available(int drive)
4113+
{
4114+
if (!(allowed_drive_mask & (1 << drive)))
4115+
return false;
4116+
if (fdc_state[FDC(drive)].version == FDC_NONE)
4117+
return false;
4118+
return true;
4119+
}
4120+
41124121
static struct kobject *floppy_find(dev_t dev, int *part, void *data)
41134122
{
41144123
int drive = (*part & 3) | ((*part & 0x80) >> 5);
4115-
if (drive >= N_DRIVE ||
4116-
!(allowed_drive_mask & (1 << drive)) ||
4117-
fdc_state[FDC(drive)].version == FDC_NONE)
4124+
if (drive >= N_DRIVE || !floppy_available(drive))
41184125
return NULL;
41194126
if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
41204127
return NULL;
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
41244131

41254132
static int __init do_floppy_init(void)
41264133
{
4127-
int i, unit, drive;
4128-
int err, dr;
4134+
int i, unit, drive, err;
41294135

41304136
set_debugt();
41314137
interruptjiffies = resultjiffies = jiffies;
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void)
41374143

41384144
raw_cmd = NULL;
41394145

4140-
for (dr = 0; dr < N_DRIVE; dr++) {
4141-
disks[dr] = alloc_disk(1);
4142-
if (!disks[dr]) {
4143-
err = -ENOMEM;
4144-
goto out_put_disk;
4145-
}
4146+
floppy_wq = alloc_ordered_workqueue("floppy", 0);
4147+
if (!floppy_wq)
4148+
return -ENOMEM;
41464149

4147-
floppy_wq = alloc_ordered_workqueue("floppy", 0);
4148-
if (!floppy_wq) {
4150+
for (drive = 0; drive < N_DRIVE; drive++) {
4151+
disks[drive] = alloc_disk(1);
4152+
if (!disks[drive]) {
41494153
err = -ENOMEM;
41504154
goto out_put_disk;
41514155
}
41524156

4153-
disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock);
4154-
if (!disks[dr]->queue) {
4157+
disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock);
4158+
if (!disks[drive]->queue) {
41554159
err = -ENOMEM;
4156-
goto out_destroy_workq;
4160+
goto out_put_disk;
41574161
}
41584162

4159-
blk_queue_max_hw_sectors(disks[dr]->queue, 64);
4160-
disks[dr]->major = FLOPPY_MAJOR;
4161-
disks[dr]->first_minor = TOMINOR(dr);
4162-
disks[dr]->fops = &floppy_fops;
4163-
sprintf(disks[dr]->disk_name, "fd%d", dr);
4163+
blk_queue_max_hw_sectors(disks[drive]->queue, 64);
4164+
disks[drive]->major = FLOPPY_MAJOR;
4165+
disks[drive]->first_minor = TOMINOR(drive);
4166+
disks[drive]->fops = &floppy_fops;
4167+
sprintf(disks[drive]->disk_name, "fd%d", drive);
41644168

4165-
init_timer(&motor_off_timer[dr]);
4166-
motor_off_timer[dr].data = dr;
4167-
motor_off_timer[dr].function = motor_off_callback;
4169+
init_timer(&motor_off_timer[drive]);
4170+
motor_off_timer[drive].data = drive;
4171+
motor_off_timer[drive].function = motor_off_callback;
41684172
}
41694173

41704174
err = register_blkdev(FLOPPY_MAJOR, "fd");
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void)
42824286
}
42834287

42844288
for (drive = 0; drive < N_DRIVE; drive++) {
4285-
if (!(allowed_drive_mask & (1 << drive)))
4286-
continue;
4287-
if (fdc_state[FDC(drive)].version == FDC_NONE)
4289+
if (!floppy_available(drive))
42884290
continue;
42894291

42904292
floppy_device[drive].name = floppy_device_name;
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void)
42934295

42944296
err = platform_device_register(&floppy_device[drive]);
42954297
if (err)
4296-
goto out_release_dma;
4298+
goto out_remove_drives;
42974299

42984300
err = device_create_file(&floppy_device[drive].dev,
42994301
&dev_attr_cmos);
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void)
43114313

43124314
out_unreg_platform_dev:
43134315
platform_device_unregister(&floppy_device[drive]);
4316+
out_remove_drives:
4317+
while (drive--) {
4318+
if (floppy_available(drive)) {
4319+
del_gendisk(disks[drive]);
4320+
device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4321+
platform_device_unregister(&floppy_device[drive]);
4322+
}
4323+
}
43144324
out_release_dma:
43154325
if (atomic_read(&usage_count))
43164326
floppy_release_irq_and_dma();
43174327
out_unreg_region:
43184328
blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
43194329
platform_driver_unregister(&floppy_driver);
4320-
out_destroy_workq:
4321-
destroy_workqueue(floppy_wq);
43224330
out_unreg_blkdev:
43234331
unregister_blkdev(FLOPPY_MAJOR, "fd");
43244332
out_put_disk:
4325-
while (dr--) {
4326-
del_timer_sync(&motor_off_timer[dr]);
4327-
if (disks[dr]->queue) {
4328-
blk_cleanup_queue(disks[dr]->queue);
4329-
/*
4330-
* put_disk() is not paired with add_disk() and
4331-
* will put queue reference one extra time. fix it.
4332-
*/
4333-
disks[dr]->queue = NULL;
4333+
for (drive = 0; drive < N_DRIVE; drive++) {
4334+
if (!disks[drive])
4335+
break;
4336+
if (disks[drive]->queue) {
4337+
del_timer_sync(&motor_off_timer[drive]);
4338+
blk_cleanup_queue(disks[drive]->queue);
4339+
disks[drive]->queue = NULL;
43344340
}
4335-
put_disk(disks[dr]);
4341+
put_disk(disks[drive]);
43364342
}
4343+
destroy_workqueue(floppy_wq);
43374344
return err;
43384345
}
43394346

@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void)
45514558
for (drive = 0; drive < N_DRIVE; drive++) {
45524559
del_timer_sync(&motor_off_timer[drive]);
45534560

4554-
if ((allowed_drive_mask & (1 << drive)) &&
4555-
fdc_state[FDC(drive)].version != FDC_NONE) {
4561+
if (floppy_available(drive)) {
45564562
del_gendisk(disks[drive]);
45574563
device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
45584564
platform_device_unregister(&floppy_device[drive]);

drivers/block/loop.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo)
976976
if (lo->lo_state != Lo_bound)
977977
return -ENXIO;
978978

979-
if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */
980-
return -EBUSY;
979+
/*
980+
* If we've explicitly asked to tear down the loop device,
981+
* and it has an elevated reference count, set it for auto-teardown when
982+
* the last reference goes away. This stops $!~#$@ udev from
983+
* preventing teardown because it decided that it needs to run blkid on
984+
* the loopback device whenever they appear. xfstests is notorious for
985+
* failing tests because blkid via udev races with a losetup
986+
* <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d
987+
* command to fail with EBUSY.
988+
*/
989+
if (lo->lo_refcnt > 1) {
990+
lo->lo_flags |= LO_FLAGS_AUTOCLEAR;
991+
mutex_unlock(&lo->lo_ctl_mutex);
992+
return 0;
993+
}
981994

982995
if (filp == NULL)
983996
return -EINVAL;

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,16 +2035,20 @@ static unsigned int implicit_sector(unsigned char command,
20352035
}
20362036
return rv;
20372037
}
2038-
2039-
static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2038+
static void mtip_set_timeout(struct driver_data *dd,
2039+
struct host_to_dev_fis *fis,
2040+
unsigned int *timeout, u8 erasemode)
20402041
{
20412042
switch (fis->command) {
20422043
case ATA_CMD_DOWNLOAD_MICRO:
20432044
*timeout = 120000; /* 2 minutes */
20442045
break;
20452046
case ATA_CMD_SEC_ERASE_UNIT:
20462047
case 0xFC:
2047-
*timeout = 240000; /* 4 minutes */
2048+
if (erasemode)
2049+
*timeout = ((*(dd->port->identify + 90) * 2) * 60000);
2050+
else
2051+
*timeout = ((*(dd->port->identify + 89) * 2) * 60000);
20482052
break;
20492053
case ATA_CMD_STANDBYNOW1:
20502054
*timeout = 120000; /* 2 minutes */
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
20872091
unsigned int transfer_size;
20882092
unsigned long task_file_data;
20892093
int intotal = outtotal + req_task->out_size;
2094+
int erasemode = 0;
20902095

20912096
taskout = req_task->out_size;
20922097
taskin = req_task->in_size;
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd,
22122217
fis.lba_hi,
22132218
fis.device);
22142219

2215-
mtip_set_timeout(&fis, &timeout);
2220+
/* check for erase mode support during secure erase.*/
2221+
if ((fis.command == ATA_CMD_SEC_ERASE_UNIT)
2222+
&& (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
2223+
erasemode = 1;
2224+
}
2225+
2226+
mtip_set_timeout(dd, &fis, &timeout, erasemode);
22162227

22172228
/* Determine the correct transfer size.*/
22182229
if (force_single_sector)

drivers/block/mtip32xx/mtip32xx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
/* offset of Device Control register in PCIe extended capabilites space */
3434
#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
3535

36+
/* check for erase mode support during secure erase */
37+
#define MTIP_SEC_ERASE_MODE 0x3
38+
3639
/* # of times to retry timed out/failed IOs */
3740
#define MTIP_MAX_RETRIES 2
3841

drivers/block/xen-blkback/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ struct xen_vbd {
158158
struct block_device *bdev;
159159
/* Cached size parameter. */
160160
sector_t size;
161-
bool flush_support;
162-
bool discard_secure;
161+
unsigned int flush_support:1;
162+
unsigned int discard_secure:1;
163163
};
164164

165165
struct backend_info;

0 commit comments

Comments
 (0)