Skip to content

Commit c9193f4

Browse files
committed
Merge tag 'for-5.17/drivers-2022-01-11' of git://git.kernel.dk/linux-block
Pull block driver updates from Jens Axboe: - mtip32xx pci cleanups (Bjorn) - mtip32xx conversion to generic power management (Vaibhav) - rsxx pci powermanagement cleanups (Bjorn) - Remove the rsxx driver. This hardware never saw much adoption, and it's been end of lifed for a while. (Christoph) - MD pull request from Song: - REQ_NOWAIT support (Vishal Verma) - raid6 benchmark optimization (Dirk Müller) - Fix for acct bioset (Xiao Ni) - Clean up max_queued_requests (Mariusz Tkaczyk) - PREEMPT_RT optimization (Davidlohr Bueso) - Use default_groups in kobj_type (Greg Kroah-Hartman) - Use attribute groups in pktcdvd and rnbd (Greg) - NVMe pull request from Christoph: - increment request genctr on completion (Keith Busch, Geliang Tang) - add a 'iopolicy' module parameter (Hannes Reinecke) - print out valid arguments when reading from /dev/nvme-fabrics (Hannes Reinecke) - Use struct_group() in drbd (Kees) - null_blk fixes (Ming) - Get rid of congestion logic in pktcdvd (Neil) - Floppy ejection hang fix (Tasos) - Floppy max user request size fix (Xiongwei) - Loop locking fix (Tetsuo) * tag 'for-5.17/drivers-2022-01-11' of git://git.kernel.dk/linux-block: (32 commits) md: use default_groups in kobj_type md: Move alloc/free acct bioset in to personality lib/raid6: Use strict priority ranking for pq gen() benchmarking lib/raid6: skip benchmark of non-chosen xor_syndrome functions md: fix spelling of "its" md: raid456 add nowait support md: raid10 add nowait support md: raid1 add nowait support md: add support for REQ_NOWAIT md: drop queue limitation for RAID1 and RAID10 md/raid5: play nice with PREEMPT_RT block/rnbd-clt-sysfs: use default_groups in kobj_type pktcdvd: convert to use attribute groups block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0 nvme: add 'iopolicy' module parameter nvme: drop unused variable ctrl in nvme_setup_cmd nvme: increment request genctr on completion nvme-fabrics: print out valid arguments when reading from /dev/nvme-fabrics block: remove the rsxx driver rsxx: Drop PCI legacy power management ...
2 parents d3c8108 + d85bd82 commit c9193f4

40 files changed

+612
-4501
lines changed

MAINTAINERS

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7489,12 +7489,6 @@ F: Documentation/firmware_class/
74897489
F: drivers/base/firmware_loader/
74907490
F: include/linux/firmware.h
74917491

7492-
FLASH ADAPTER DRIVER (IBM Flash Adapter 900GB Full Height PCI Flash Card)
7493-
M: Joshua Morris <[email protected]>
7494-
M: Philip Kelleher <[email protected]>
7495-
S: Maintained
7496-
F: drivers/block/rsxx/
7497-
74987492
FLEXTIMER FTM-QUADDEC DRIVER
74997493
M: Patrick Havelange <[email protected]>
75007494

drivers/block/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,17 +392,6 @@ config BLK_DEV_RBD
392392

393393
If unsure, say N.
394394

395-
config BLK_DEV_RSXX
396-
tristate "IBM Flash Adapter 900GB Full Height PCIe Device Driver"
397-
depends on PCI
398-
select CRC32
399-
help
400-
Device driver for IBM's high speed PCIe SSD
401-
storage device: Flash Adapter 900GB Full Height.
402-
403-
To compile this driver as a module, choose M here: the
404-
module will be called rsxx.
405-
406395
source "drivers/block/rnbd/Kconfig"
407396

408397
endif # BLK_DEV

drivers/block/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
3434
obj-$(CONFIG_BLK_DEV_RBD) += rbd.o
3535
obj-$(CONFIG_BLK_DEV_PCIESSD_MTIP32XX) += mtip32xx/
3636

37-
obj-$(CONFIG_BLK_DEV_RSXX) += rsxx/
3837
obj-$(CONFIG_ZRAM) += zram/
3938
obj-$(CONFIG_BLK_DEV_RNBD) += rnbd/
4039

drivers/block/drbd/drbd_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ int drbd_send_sync_param(struct drbd_peer_device *peer_device)
729729
cmd = apv >= 89 ? P_SYNC_PARAM89 : P_SYNC_PARAM;
730730

731731
/* initialize verify_alg and csums_alg */
732-
memset(p->verify_alg, 0, 2 * SHARED_SECRET_MAX);
732+
BUILD_BUG_ON(sizeof(p->algs) != 2 * SHARED_SECRET_MAX);
733+
memset(&p->algs, 0, sizeof(p->algs));
733734

734735
if (get_ldev(peer_device->device)) {
735736
dc = rcu_dereference(peer_device->device->ldev->disk_conf);

drivers/block/drbd/drbd_protocol.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ struct p_rs_param_89 {
283283

284284
struct p_rs_param_95 {
285285
u32 resync_rate;
286-
char verify_alg[SHARED_SECRET_MAX];
287-
char csums_alg[SHARED_SECRET_MAX];
286+
struct_group(algs,
287+
char verify_alg[SHARED_SECRET_MAX];
288+
char csums_alg[SHARED_SECRET_MAX];
289+
);
288290
u32 c_plan_ahead;
289291
u32 c_delay_target;
290292
u32 c_fill_target;

drivers/block/drbd/drbd_receiver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3921,7 +3921,8 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
39213921

39223922
/* initialize verify_alg and csums_alg */
39233923
p = pi->data;
3924-
memset(p->verify_alg, 0, 2 * SHARED_SECRET_MAX);
3924+
BUILD_BUG_ON(sizeof(p->algs) != 2 * SHARED_SECRET_MAX);
3925+
memset(&p->algs, 0, sizeof(p->algs));
39253926

39263927
err = drbd_recv_all(peer_device->connection, p, header_size);
39273928
if (err)

drivers/block/floppy.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn);
10151015
static void cancel_activity(void)
10161016
{
10171017
do_floppy = NULL;
1018-
cancel_delayed_work_sync(&fd_timer);
1018+
cancel_delayed_work(&fd_timer);
10191019
cancel_work_sync(&floppy_work);
10201020
}
10211021

@@ -3081,6 +3081,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr)
30813081
}
30823082
}
30833083

3084+
#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT)
3085+
30843086
static int raw_cmd_copyin(int cmd, void __user *param,
30853087
struct floppy_raw_cmd **rcmd)
30863088
{
@@ -3108,7 +3110,7 @@ static int raw_cmd_copyin(int cmd, void __user *param,
31083110
ptr->resultcode = 0;
31093111

31103112
if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
3111-
if (ptr->length <= 0)
3113+
if (ptr->length <= 0 || ptr->length >= MAX_LEN)
31123114
return -EINVAL;
31133115
ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length);
31143116
fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length);

drivers/block/loop.c

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,10 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
10821082
return error;
10831083
}
10841084

1085-
static int __loop_clr_fd(struct loop_device *lo, bool release)
1085+
static void __loop_clr_fd(struct loop_device *lo)
10861086
{
1087-
struct file *filp = NULL;
1087+
struct file *filp;
10881088
gfp_t gfp = lo->old_gfp_mask;
1089-
int err = 0;
1090-
bool partscan = false;
1091-
int lo_number;
10921089
struct loop_worker *pos, *worker;
10931090

10941091
/*
@@ -1103,17 +1100,14 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
11031100
* became visible.
11041101
*/
11051102

1103+
/*
1104+
* Since this function is called upon "ioctl(LOOP_CLR_FD)" xor "close()
1105+
* after ioctl(LOOP_CLR_FD)", it is a sign of something going wrong if
1106+
* lo->lo_state has changed while waiting for lo->lo_mutex.
1107+
*/
11061108
mutex_lock(&lo->lo_mutex);
1107-
if (WARN_ON_ONCE(lo->lo_state != Lo_rundown)) {
1108-
err = -ENXIO;
1109-
goto out_unlock;
1110-
}
1111-
1112-
filp = lo->lo_backing_file;
1113-
if (filp == NULL) {
1114-
err = -EINVAL;
1115-
goto out_unlock;
1116-
}
1109+
BUG_ON(lo->lo_state != Lo_rundown);
1110+
mutex_unlock(&lo->lo_mutex);
11171111

11181112
if (test_bit(QUEUE_FLAG_WC, &lo->lo_queue->queue_flags))
11191113
blk_queue_write_cache(lo->lo_queue, false, false);
@@ -1134,6 +1128,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
11341128
del_timer_sync(&lo->timer);
11351129

11361130
spin_lock_irq(&lo->lo_lock);
1131+
filp = lo->lo_backing_file;
11371132
lo->lo_backing_file = NULL;
11381133
spin_unlock_irq(&lo->lo_lock);
11391134

@@ -1149,60 +1144,59 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
11491144
/* let user-space know about this change */
11501145
kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
11511146
mapping_set_gfp_mask(filp->f_mapping, gfp);
1152-
/* This is safe: open() is still holding a reference. */
1153-
module_put(THIS_MODULE);
11541147
blk_mq_unfreeze_queue(lo->lo_queue);
11551148

1156-
partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
1157-
lo_number = lo->lo_number;
11581149
disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
1159-
out_unlock:
1160-
mutex_unlock(&lo->lo_mutex);
1161-
if (partscan) {
1162-
/*
1163-
* open_mutex has been held already in release path, so don't
1164-
* acquire it if this function is called in such case.
1165-
*
1166-
* If the reread partition isn't from release path, lo_refcnt
1167-
* must be at least one and it can only become zero when the
1168-
* current holder is released.
1169-
*/
1170-
if (!release)
1171-
mutex_lock(&lo->lo_disk->open_mutex);
1150+
1151+
if (lo->lo_flags & LO_FLAGS_PARTSCAN) {
1152+
int err;
1153+
1154+
mutex_lock(&lo->lo_disk->open_mutex);
11721155
err = bdev_disk_changed(lo->lo_disk, false);
1173-
if (!release)
1174-
mutex_unlock(&lo->lo_disk->open_mutex);
1156+
mutex_unlock(&lo->lo_disk->open_mutex);
11751157
if (err)
11761158
pr_warn("%s: partition scan of loop%d failed (rc=%d)\n",
1177-
__func__, lo_number, err);
1159+
__func__, lo->lo_number, err);
11781160
/* Device is gone, no point in returning error */
1179-
err = 0;
11801161
}
11811162

1182-
/*
1183-
* lo->lo_state is set to Lo_unbound here after above partscan has
1184-
* finished.
1185-
*
1186-
* There cannot be anybody else entering __loop_clr_fd() as
1187-
* lo->lo_backing_file is already cleared and Lo_rundown state
1188-
* protects us from all the other places trying to change the 'lo'
1189-
* device.
1190-
*/
1191-
mutex_lock(&lo->lo_mutex);
11921163
lo->lo_flags = 0;
11931164
if (!part_shift)
11941165
lo->lo_disk->flags |= GENHD_FL_NO_PART;
1166+
1167+
fput(filp);
1168+
}
1169+
1170+
static void loop_rundown_completed(struct loop_device *lo)
1171+
{
1172+
mutex_lock(&lo->lo_mutex);
11951173
lo->lo_state = Lo_unbound;
11961174
mutex_unlock(&lo->lo_mutex);
1175+
module_put(THIS_MODULE);
1176+
}
11971177

1198-
/*
1199-
* Need not hold lo_mutex to fput backing file. Calling fput holding
1200-
* lo_mutex triggers a circular lock dependency possibility warning as
1201-
* fput can take open_mutex which is usually taken before lo_mutex.
1202-
*/
1203-
if (filp)
1204-
fput(filp);
1205-
return err;
1178+
static void loop_rundown_workfn(struct work_struct *work)
1179+
{
1180+
struct loop_device *lo = container_of(work, struct loop_device,
1181+
rundown_work);
1182+
struct block_device *bdev = lo->lo_device;
1183+
struct gendisk *disk = lo->lo_disk;
1184+
1185+
__loop_clr_fd(lo);
1186+
kobject_put(&bdev->bd_device.kobj);
1187+
module_put(disk->fops->owner);
1188+
loop_rundown_completed(lo);
1189+
}
1190+
1191+
static void loop_schedule_rundown(struct loop_device *lo)
1192+
{
1193+
struct block_device *bdev = lo->lo_device;
1194+
struct gendisk *disk = lo->lo_disk;
1195+
1196+
__module_get(disk->fops->owner);
1197+
kobject_get(&bdev->bd_device.kobj);
1198+
INIT_WORK(&lo->rundown_work, loop_rundown_workfn);
1199+
queue_work(system_long_wq, &lo->rundown_work);
12061200
}
12071201

12081202
static int loop_clr_fd(struct loop_device *lo)
@@ -1234,7 +1228,9 @@ static int loop_clr_fd(struct loop_device *lo)
12341228
lo->lo_state = Lo_rundown;
12351229
mutex_unlock(&lo->lo_mutex);
12361230

1237-
return __loop_clr_fd(lo, false);
1231+
__loop_clr_fd(lo);
1232+
loop_rundown_completed(lo);
1233+
return 0;
12381234
}
12391235

12401236
static int
@@ -1758,7 +1754,7 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
17581754
* In autoclear mode, stop the loop thread
17591755
* and remove configuration after last close.
17601756
*/
1761-
__loop_clr_fd(lo, true);
1757+
loop_schedule_rundown(lo);
17621758
return;
17631759
} else if (lo->lo_state == Lo_bound) {
17641760
/*

drivers/block/loop.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct loop_device {
5656
struct gendisk *lo_disk;
5757
struct mutex lo_mutex;
5858
bool idr_visible;
59+
struct work_struct rundown_work;
5960
};
6061

6162
struct loop_cmd {

0 commit comments

Comments
 (0)