Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull block fixes from Jens Axboe:
"A collection of fixes from the past few weeks that should go into 4.5.
This contains:

- Overflow fix for sysfs discard show function from Alan.

- A stacking limit init fix for max_dev_sectors, so we don't end up
artificially capping some use cases. From Keith.

- Have blk-mq proper end unstarted requests on a dying queue, instead
of pushing that to the driver. From Keith.

- NVMe:
- Update to Kconfig description for NVME_SCSI, since it was
vague and having it on is important for some SUSE distros.
From Christoph.
- Set of fixes from Keith, around surprise removal. Also kills
the no-merge flag, so it supports merging.

- Set of fixes for lightnvm from Matias, Javier, and Wenwei.

- Fix null_blk oops when asked for lightnvm, but not available. From
Matias.

- Copy-to-user EINTR fix from Hannes, fixing a case where SG_IO fails
if interrupted by a signal.

- Two floppy fixes from Jiri, fixing signal handling and blocking
open.

- A use-after-free fix for O_DIRECT, from Mike Krinkin.

- A block module ref count fix from Roman Pen.

- An fs IO wait accounting fix for O_DSYNC from Stephane Gasparini.

- Smaller reallo fix for xen-blkfront from Bob Liu.

- Removal of an unused struct member in the deadline IO scheduler,
from Tahsin.

- Also from Tahsin, properly initialize inode struct members
associated with cgroup writeback, if enabled.

- From Tejun, ensure that we keep the superblock pinned during cgroup
writeback"

* 'for-linus' of git://git.kernel.dk/linux-block: (25 commits)
blk: fix overflow in queue_discard_max_hw_show
writeback: initialize inode members that track writeback history
writeback: keep superblock pinned during cgroup writeback association switches
bio: return EINTR if copying to user space got interrupted
NVMe: Rate limit nvme IO warnings
NVMe: Poll device while still active during remove
NVMe: Requeue requests on suspended queues
NVMe: Allow request merges
NVMe: Fix io incapable return values
blk-mq: End unstarted requests on dying queue
block: Initialize max_dev_sectors to 0
null_blk: oops when initializing without lightnvm
block: fix module reference leak on put_disk() call for cgroups throttle
nvme: fix Kconfig description for BLK_DEV_NVME_SCSI
kernel/fs: fix I/O wait not accounted for RW O_DSYNC
floppy: refactor open() flags handling
lightnvm: allow to force mm initialization
lightnvm: check overflow and correct mlc pairs
lightnvm: fix request intersection locking in rrpc
lightnvm: warn if irqs are disabled in lock laddr
...

+175 -106
+6 -3
block/bio.c
··· 874 874 bio->bi_private = &ret; 875 875 bio->bi_end_io = submit_bio_wait_endio; 876 876 submit_bio(rw, bio); 877 - wait_for_completion(&ret.event); 877 + wait_for_completion_io(&ret.event); 878 878 879 879 return ret.error; 880 880 } ··· 1090 1090 if (!bio_flagged(bio, BIO_NULL_MAPPED)) { 1091 1091 /* 1092 1092 * if we're in a workqueue, the request is orphaned, so 1093 - * don't copy into a random user address space, just free. 1093 + * don't copy into a random user address space, just free 1094 + * and return -EINTR so user space doesn't expect any data. 1094 1095 */ 1095 - if (current->mm && bio_data_dir(bio) == READ) 1096 + if (!current->mm) 1097 + ret = -EINTR; 1098 + else if (bio_data_dir(bio) == READ) 1096 1099 ret = bio_copy_to_iter(bio, bmd->iter); 1097 1100 if (bmd->is_our_pages) 1098 1101 bio_free_pages(bio);
+9
block/blk-cgroup.c
··· 788 788 { 789 789 struct gendisk *disk; 790 790 struct blkcg_gq *blkg; 791 + struct module *owner; 791 792 unsigned int major, minor; 792 793 int key_len, part, ret; 793 794 char *body; ··· 805 804 if (!disk) 806 805 return -ENODEV; 807 806 if (part) { 807 + owner = disk->fops->owner; 808 808 put_disk(disk); 809 + module_put(owner); 809 810 return -ENODEV; 810 811 } 811 812 ··· 823 820 ret = PTR_ERR(blkg); 824 821 rcu_read_unlock(); 825 822 spin_unlock_irq(disk->queue->queue_lock); 823 + owner = disk->fops->owner; 826 824 put_disk(disk); 825 + module_put(owner); 827 826 /* 828 827 * If queue was bypassing, we should retry. Do so after a 829 828 * short msleep(). It isn't strictly necessary but queue ··· 856 851 void blkg_conf_finish(struct blkg_conf_ctx *ctx) 857 852 __releases(ctx->disk->queue->queue_lock) __releases(rcu) 858 853 { 854 + struct module *owner; 855 + 859 856 spin_unlock_irq(ctx->disk->queue->queue_lock); 860 857 rcu_read_unlock(); 858 + owner = ctx->disk->fops->owner; 861 859 put_disk(ctx->disk); 860 + module_put(owner); 862 861 } 863 862 EXPORT_SYMBOL_GPL(blkg_conf_finish); 864 863
+4 -2
block/blk-mq.c
··· 599 599 * If a request wasn't started before the queue was 600 600 * marked dying, kill it here or it'll go unnoticed. 601 601 */ 602 - if (unlikely(blk_queue_dying(rq->q))) 603 - blk_mq_complete_request(rq, -EIO); 602 + if (unlikely(blk_queue_dying(rq->q))) { 603 + rq->errors = -EIO; 604 + blk_mq_end_request(rq, rq->errors); 605 + } 604 606 return; 605 607 } 606 608
+2 -2
block/blk-settings.c
··· 91 91 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK; 92 92 lim->virt_boundary_mask = 0; 93 93 lim->max_segment_size = BLK_MAX_SEGMENT_SIZE; 94 - lim->max_sectors = lim->max_dev_sectors = lim->max_hw_sectors = 95 - BLK_SAFE_MAX_SECTORS; 94 + lim->max_sectors = lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS; 95 + lim->max_dev_sectors = 0; 96 96 lim->chunk_sectors = 0; 97 97 lim->max_write_same_sectors = 0; 98 98 lim->max_discard_sectors = 0;
+2 -3
block/blk-sysfs.c
··· 147 147 148 148 static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page) 149 149 { 150 - unsigned long long val; 151 150 152 - val = q->limits.max_hw_discard_sectors << 9; 153 - return sprintf(page, "%llu\n", val); 151 + return sprintf(page, "%llu\n", 152 + (unsigned long long)q->limits.max_hw_discard_sectors << 9); 154 153 } 155 154 156 155 static ssize_t queue_discard_max_show(struct request_queue *q, char *page)
-3
block/deadline-iosched.c
··· 39 39 */ 40 40 struct request *next_rq[2]; 41 41 unsigned int batching; /* number of sequential requests made */ 42 - sector_t last_sector; /* head position */ 43 42 unsigned int starved; /* times reads have starved writes */ 44 43 45 44 /* ··· 208 209 dd->next_rq[READ] = NULL; 209 210 dd->next_rq[WRITE] = NULL; 210 211 dd->next_rq[data_dir] = deadline_latter_request(rq); 211 - 212 - dd->last_sector = rq_end_sector(rq); 213 212 214 213 /* 215 214 * take it off the sort and fifo list, move
+37 -30
drivers/block/floppy.c
··· 866 866 } 867 867 868 868 /* locks the driver */ 869 - static int lock_fdc(int drive, bool interruptible) 869 + static int lock_fdc(int drive) 870 870 { 871 871 if (WARN(atomic_read(&usage_count) == 0, 872 872 "Trying to lock fdc while usage count=0\n")) ··· 2173 2173 { 2174 2174 int ret; 2175 2175 2176 - if (lock_fdc(drive, true)) 2176 + if (lock_fdc(drive)) 2177 2177 return -EINTR; 2178 2178 2179 2179 set_floppy(drive); ··· 2960 2960 { 2961 2961 int ret; 2962 2962 2963 - if (lock_fdc(drive, interruptible)) 2963 + if (lock_fdc(drive)) 2964 2964 return -EINTR; 2965 2965 2966 2966 if (arg == FD_RESET_ALWAYS) ··· 3243 3243 if (!capable(CAP_SYS_ADMIN)) 3244 3244 return -EPERM; 3245 3245 mutex_lock(&open_lock); 3246 - if (lock_fdc(drive, true)) { 3246 + if (lock_fdc(drive)) { 3247 3247 mutex_unlock(&open_lock); 3248 3248 return -EINTR; 3249 3249 } ··· 3263 3263 } else { 3264 3264 int oldStretch; 3265 3265 3266 - if (lock_fdc(drive, true)) 3266 + if (lock_fdc(drive)) 3267 3267 return -EINTR; 3268 3268 if (cmd != FDDEFPRM) { 3269 3269 /* notice a disk change immediately, else ··· 3349 3349 if (type) 3350 3350 *g = &floppy_type[type]; 3351 3351 else { 3352 - if (lock_fdc(drive, false)) 3352 + if (lock_fdc(drive)) 3353 3353 return -EINTR; 3354 3354 if (poll_drive(false, 0) == -EINTR) 3355 3355 return -EINTR; ··· 3433 3433 if (UDRS->fd_ref != 1) 3434 3434 /* somebody else has this drive open */ 3435 3435 return -EBUSY; 3436 - if (lock_fdc(drive, true)) 3436 + if (lock_fdc(drive)) 3437 3437 return -EINTR; 3438 3438 3439 3439 /* do the actual eject. Fails on ··· 3445 3445 process_fd_request(); 3446 3446 return ret; 3447 3447 case FDCLRPRM: 3448 - if (lock_fdc(drive, true)) 3448 + if (lock_fdc(drive)) 3449 3449 return -EINTR; 3450 3450 current_type[drive] = NULL; 3451 3451 floppy_sizes[drive] = MAX_DISK_SIZE << 1; ··· 3467 3467 UDP->flags &= ~FTD_MSG; 3468 3468 return 0; 3469 3469 case FDFMTBEG: 3470 - if (lock_fdc(drive, true)) 3470 + if (lock_fdc(drive)) 3471 3471 return -EINTR; 3472 3472 if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR) 3473 3473 return -EINTR; ··· 3484 3484 return do_format(drive, &inparam.f); 3485 3485 case FDFMTEND: 3486 3486 case FDFLUSH: 3487 - if (lock_fdc(drive, true)) 3487 + if (lock_fdc(drive)) 3488 3488 return -EINTR; 3489 3489 return invalidate_drive(bdev); 3490 3490 case FDSETEMSGTRESH: ··· 3507 3507 outparam = UDP; 3508 3508 break; 3509 3509 case FDPOLLDRVSTAT: 3510 - if (lock_fdc(drive, true)) 3510 + if (lock_fdc(drive)) 3511 3511 return -EINTR; 3512 3512 if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR) 3513 3513 return -EINTR; ··· 3530 3530 case FDRAWCMD: 3531 3531 if (type) 3532 3532 return -EINVAL; 3533 - if (lock_fdc(drive, true)) 3533 + if (lock_fdc(drive)) 3534 3534 return -EINTR; 3535 3535 set_floppy(drive); 3536 3536 i = raw_cmd_ioctl(cmd, (void __user *)param); ··· 3539 3539 process_fd_request(); 3540 3540 return i; 3541 3541 case FDTWADDLE: 3542 - if (lock_fdc(drive, true)) 3542 + if (lock_fdc(drive)) 3543 3543 return -EINTR; 3544 3544 twaddle(); 3545 3545 process_fd_request(); ··· 3663 3663 3664 3664 opened_bdev[drive] = bdev; 3665 3665 3666 + if (!(mode & (FMODE_READ|FMODE_WRITE))) { 3667 + res = -EINVAL; 3668 + goto out; 3669 + } 3670 + 3666 3671 res = -ENXIO; 3667 3672 3668 3673 if (!floppy_track_buffer) { ··· 3711 3706 if (UFDCS->rawcmd == 1) 3712 3707 UFDCS->rawcmd = 2; 3713 3708 3714 - if (!(mode & FMODE_NDELAY)) { 3715 - if (mode & (FMODE_READ|FMODE_WRITE)) { 3716 - UDRS->last_checked = 0; 3717 - clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); 3718 - check_disk_change(bdev); 3719 - if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags)) 3720 - goto out; 3721 - if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) 3722 - goto out; 3723 - } 3724 - res = -EROFS; 3725 - if ((mode & FMODE_WRITE) && 3726 - !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) 3727 - goto out; 3728 - } 3709 + UDRS->last_checked = 0; 3710 + clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); 3711 + check_disk_change(bdev); 3712 + if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags)) 3713 + goto out; 3714 + if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) 3715 + goto out; 3716 + 3717 + res = -EROFS; 3718 + 3719 + if ((mode & FMODE_WRITE) && 3720 + !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) 3721 + goto out; 3722 + 3729 3723 mutex_unlock(&open_lock); 3730 3724 mutex_unlock(&floppy_mutex); 3731 3725 return 0; ··· 3752 3748 return DISK_EVENT_MEDIA_CHANGE; 3753 3749 3754 3750 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { 3755 - lock_fdc(drive, false); 3751 + if (lock_fdc(drive)) 3752 + return -EINTR; 3756 3753 poll_drive(false, 0); 3757 3754 process_fd_request(); 3758 3755 } ··· 3852 3847 "VFS: revalidate called on non-open device.\n")) 3853 3848 return -EFAULT; 3854 3849 3855 - lock_fdc(drive, false); 3850 + res = lock_fdc(drive); 3851 + if (res) 3852 + return res; 3856 3853 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3857 3854 test_bit(FD_VERIFY_BIT, &UDRS->flags)); 3858 3855 if (!(cf || test_bit(drive, &fake_change) || drive_no_geom(drive))) {
+5 -3
drivers/block/null_blk.c
··· 478 478 id->ver_id = 0x1; 479 479 id->vmnt = 0; 480 480 id->cgrps = 1; 481 - id->cap = 0x3; 481 + id->cap = 0x2; 482 482 id->dom = 0x1; 483 483 484 484 id->ppaf.blk_offset = 0; ··· 707 707 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); 708 708 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, nullb->q); 709 709 710 - 711 710 mutex_lock(&lock); 712 - list_add_tail(&nullb->list, &nullb_list); 713 711 nullb->index = nullb_indexes++; 714 712 mutex_unlock(&lock); 715 713 ··· 741 743 strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); 742 744 743 745 add_disk(disk); 746 + 747 + mutex_lock(&lock); 748 + list_add_tail(&nullb->list, &nullb_list); 749 + mutex_unlock(&lock); 744 750 done: 745 751 return 0; 746 752
+45 -29
drivers/block/xen-blkfront.c
··· 1873 1873 return err; 1874 1874 } 1875 1875 1876 + static int negotiate_mq(struct blkfront_info *info) 1877 + { 1878 + unsigned int backend_max_queues = 0; 1879 + int err; 1880 + unsigned int i; 1881 + 1882 + BUG_ON(info->nr_rings); 1883 + 1884 + /* Check if backend supports multiple queues. */ 1885 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 1886 + "multi-queue-max-queues", "%u", &backend_max_queues); 1887 + if (err < 0) 1888 + backend_max_queues = 1; 1889 + 1890 + info->nr_rings = min(backend_max_queues, xen_blkif_max_queues); 1891 + /* We need at least one ring. */ 1892 + if (!info->nr_rings) 1893 + info->nr_rings = 1; 1894 + 1895 + info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL); 1896 + if (!info->rinfo) { 1897 + xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); 1898 + return -ENOMEM; 1899 + } 1900 + 1901 + for (i = 0; i < info->nr_rings; i++) { 1902 + struct blkfront_ring_info *rinfo; 1903 + 1904 + rinfo = &info->rinfo[i]; 1905 + INIT_LIST_HEAD(&rinfo->indirect_pages); 1906 + INIT_LIST_HEAD(&rinfo->grants); 1907 + rinfo->dev_info = info; 1908 + INIT_WORK(&rinfo->work, blkif_restart_queue); 1909 + spin_lock_init(&rinfo->ring_lock); 1910 + } 1911 + return 0; 1912 + } 1876 1913 /** 1877 1914 * Entry point to this code when a new device is created. Allocate the basic 1878 1915 * structures and the ring buffer for communication with the backend, and ··· 1920 1883 const struct xenbus_device_id *id) 1921 1884 { 1922 1885 int err, vdevice; 1923 - unsigned int r_index; 1924 1886 struct blkfront_info *info; 1925 - unsigned int backend_max_queues = 0; 1926 1887 1927 1888 /* FIXME: Use dynamic device id if this is not set. */ 1928 1889 err = xenbus_scanf(XBT_NIL, dev->nodename, ··· 1971 1936 } 1972 1937 1973 1938 info->xbdev = dev; 1974 - /* Check if backend supports multiple queues. */ 1975 - err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 1976 - "multi-queue-max-queues", "%u", &backend_max_queues); 1977 - if (err < 0) 1978 - backend_max_queues = 1; 1979 - 1980 - info->nr_rings = min(backend_max_queues, xen_blkif_max_queues); 1981 - /* We need at least one ring. */ 1982 - if (!info->nr_rings) 1983 - info->nr_rings = 1; 1984 - 1985 - info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL); 1986 - if (!info->rinfo) { 1987 - xenbus_dev_fatal(dev, -ENOMEM, "allocating ring_info structure"); 1939 + err = negotiate_mq(info); 1940 + if (err) { 1988 1941 kfree(info); 1989 - return -ENOMEM; 1990 - } 1991 - 1992 - for (r_index = 0; r_index < info->nr_rings; r_index++) { 1993 - struct blkfront_ring_info *rinfo; 1994 - 1995 - rinfo = &info->rinfo[r_index]; 1996 - INIT_LIST_HEAD(&rinfo->indirect_pages); 1997 - INIT_LIST_HEAD(&rinfo->grants); 1998 - rinfo->dev_info = info; 1999 - INIT_WORK(&rinfo->work, blkif_restart_queue); 2000 - spin_lock_init(&rinfo->ring_lock); 1942 + return err; 2001 1943 } 2002 1944 2003 1945 mutex_init(&info->mutex); ··· 2135 2123 static int blkfront_resume(struct xenbus_device *dev) 2136 2124 { 2137 2125 struct blkfront_info *info = dev_get_drvdata(&dev->dev); 2138 - int err; 2126 + int err = 0; 2139 2127 2140 2128 dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); 2141 2129 2142 2130 blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); 2131 + 2132 + err = negotiate_mq(info); 2133 + if (err) 2134 + return err; 2143 2135 2144 2136 err = talk_to_blkback(dev, info); 2145 2137
+16 -9
drivers/lightnvm/core.c
··· 572 572 } 573 573 } 574 574 575 - ret = nvm_get_sysblock(dev, &dev->sb); 576 - if (!ret) 577 - pr_err("nvm: device not initialized.\n"); 578 - else if (ret < 0) 579 - pr_err("nvm: err (%d) on device initialization\n", ret); 575 + if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) { 576 + ret = nvm_get_sysblock(dev, &dev->sb); 577 + if (!ret) 578 + pr_err("nvm: device not initialized.\n"); 579 + else if (ret < 0) 580 + pr_err("nvm: err (%d) on device initialization\n", ret); 581 + } 580 582 581 583 /* register device with a supported media manager */ 582 584 down_write(&nvm_lock); ··· 1057 1055 strncpy(info.mmtype, init->mmtype, NVM_MMTYPE_LEN); 1058 1056 info.fs_ppa.ppa = -1; 1059 1057 1060 - ret = nvm_init_sysblock(dev, &info); 1061 - if (ret) 1062 - return ret; 1058 + if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) { 1059 + ret = nvm_init_sysblock(dev, &info); 1060 + if (ret) 1061 + return ret; 1062 + } 1063 1063 1064 1064 memcpy(&dev->sb, &info, sizeof(struct nvm_sb_info)); 1065 1065 ··· 1121 1117 dev->mt = NULL; 1122 1118 } 1123 1119 1124 - return nvm_dev_factory(dev, fact.flags); 1120 + if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) 1121 + return nvm_dev_factory(dev, fact.flags); 1122 + 1123 + return 0; 1125 1124 } 1126 1125 1127 1126 static long nvm_ctl_ioctl(struct file *file, uint cmd, unsigned long arg)
+3 -1
drivers/lightnvm/rrpc.c
··· 300 300 } 301 301 302 302 page = mempool_alloc(rrpc->page_pool, GFP_NOIO); 303 - if (!page) 303 + if (!page) { 304 + bio_put(bio); 304 305 return -ENOMEM; 306 + } 305 307 306 308 while ((slot = find_first_zero_bit(rblk->invalid_pages, 307 309 nr_pgs_per_blk)) < nr_pgs_per_blk) {
+3 -2
drivers/lightnvm/rrpc.h
··· 174 174 static inline int request_intersects(struct rrpc_inflight_rq *r, 175 175 sector_t laddr_start, sector_t laddr_end) 176 176 { 177 - return (laddr_end >= r->l_start && laddr_end <= r->l_end) && 178 - (laddr_start >= r->l_start && laddr_start <= r->l_end); 177 + return (laddr_end >= r->l_start) && (laddr_start <= r->l_end); 179 178 } 180 179 181 180 static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr, ··· 182 183 { 183 184 sector_t laddr_end = laddr + pages - 1; 184 185 struct rrpc_inflight_rq *rtmp; 186 + 187 + WARN_ON(irqs_disabled()); 185 188 186 189 spin_lock_irq(&rrpc->inflights.lock); 187 190 list_for_each_entry(rtmp, &rrpc->inflights.reqs, list) {
+3 -2
drivers/nvme/host/Kconfig
··· 17 17 and block devices nodes, as well a a translation for a small 18 18 number of selected SCSI commands to NVMe commands to the NVMe 19 19 driver. If you don't know what this means you probably want 20 - to say N here, and if you know what it means you probably 21 - want to say N as well. 20 + to say N here, unless you run a distro that abuses the SCSI 21 + emulation to provide stable device names for mount by id, like 22 + some OpenSuSE and SLES versions.
-1
drivers/nvme/host/core.c
··· 1121 1121 ns->queue = blk_mq_init_queue(ctrl->tagset); 1122 1122 if (IS_ERR(ns->queue)) 1123 1123 goto out_free_ns; 1124 - queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, ns->queue); 1125 1124 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, ns->queue); 1126 1125 ns->queue->queuedata = ns; 1127 1126 ns->ctrl = ctrl;
+9 -3
drivers/nvme/host/lightnvm.c
··· 146 146 }; 147 147 }; 148 148 149 + #define NVME_NVM_LP_MLC_PAIRS 886 149 150 struct nvme_nvm_lp_mlc { 150 151 __u16 num_pairs; 151 - __u8 pairs[886]; 152 + __u8 pairs[NVME_NVM_LP_MLC_PAIRS]; 152 153 }; 153 154 154 155 struct nvme_nvm_lp_tbl { ··· 283 282 memcpy(dst->lptbl.id, src->lptbl.id, 8); 284 283 dst->lptbl.mlc.num_pairs = 285 284 le16_to_cpu(src->lptbl.mlc.num_pairs); 286 - /* 4 bits per pair */ 285 + 286 + if (dst->lptbl.mlc.num_pairs > NVME_NVM_LP_MLC_PAIRS) { 287 + pr_err("nvm: number of MLC pairs not supported\n"); 288 + return -EINVAL; 289 + } 290 + 287 291 memcpy(dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs, 288 - dst->lptbl.mlc.num_pairs >> 1); 292 + dst->lptbl.mlc.num_pairs); 289 293 } 290 294 } 291 295
+2 -2
drivers/nvme/host/nvme.h
··· 139 139 u32 val = 0; 140 140 141 141 if (ctrl->ops->io_incapable(ctrl)) 142 - return false; 142 + return true; 143 143 if (ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &val)) 144 - return false; 144 + return true; 145 145 return val & NVME_CSTS_CFS; 146 146 } 147 147
+7 -6
drivers/nvme/host/pci.c
··· 678 678 blk_mq_start_request(req); 679 679 680 680 spin_lock_irq(&nvmeq->q_lock); 681 + if (unlikely(nvmeq->cq_vector < 0)) { 682 + ret = BLK_MQ_RQ_QUEUE_BUSY; 683 + spin_unlock_irq(&nvmeq->q_lock); 684 + goto out; 685 + } 681 686 __nvme_submit_cmd(nvmeq, &cmnd); 682 687 nvme_process_cq(nvmeq); 683 688 spin_unlock_irq(&nvmeq->q_lock); ··· 1004 999 if (!blk_mq_request_started(req)) 1005 1000 return; 1006 1001 1007 - dev_warn(nvmeq->q_dmadev, 1002 + dev_dbg_ratelimited(nvmeq->q_dmadev, 1008 1003 "Cancelling I/O %d QID %d\n", req->tag, nvmeq->qid); 1009 1004 1010 1005 status = NVME_SC_ABORT_REQ; ··· 2116 2111 { 2117 2112 struct nvme_dev *dev = pci_get_drvdata(pdev); 2118 2113 2119 - spin_lock(&dev_list_lock); 2120 - list_del_init(&dev->node); 2121 - spin_unlock(&dev_list_lock); 2122 - 2123 2114 pci_set_drvdata(pdev, NULL); 2124 - flush_work(&dev->reset_work); 2125 2115 flush_work(&dev->scan_work); 2126 2116 nvme_remove_namespaces(&dev->ctrl); 2127 2117 nvme_uninit_ctrl(&dev->ctrl); 2128 2118 nvme_dev_disable(dev, true); 2119 + flush_work(&dev->reset_work); 2129 2120 nvme_dev_remove_admin(dev); 2130 2121 nvme_free_queues(dev, 0); 2131 2122 nvme_release_cmb(dev);
+1 -1
fs/direct-io.c
··· 472 472 dio->io_error = -EIO; 473 473 474 474 if (dio->is_async && dio->rw == READ && dio->should_dirty) { 475 - bio_check_pages_dirty(bio); /* transfers ownership */ 476 475 err = bio->bi_error; 476 + bio_check_pages_dirty(bio); /* transfers ownership */ 477 477 } else { 478 478 bio_for_each_segment_all(bvec, bio, i) { 479 479 struct page *page = bvec->bv_page;
+11 -4
fs/fs-writeback.c
··· 317 317 struct inode_switch_wbs_context *isw = 318 318 container_of(work, struct inode_switch_wbs_context, work); 319 319 struct inode *inode = isw->inode; 320 + struct super_block *sb = inode->i_sb; 320 321 struct address_space *mapping = inode->i_mapping; 321 322 struct bdi_writeback *old_wb = inode->i_wb; 322 323 struct bdi_writeback *new_wb = isw->new_wb; ··· 424 423 wb_put(new_wb); 425 424 426 425 iput(inode); 426 + deactivate_super(sb); 427 427 kfree(isw); 428 428 } 429 429 ··· 471 469 472 470 /* while holding I_WB_SWITCH, no one else can update the association */ 473 471 spin_lock(&inode->i_lock); 472 + 474 473 if (inode->i_state & (I_WB_SWITCH | I_FREEING) || 475 - inode_to_wb(inode) == isw->new_wb) { 476 - spin_unlock(&inode->i_lock); 477 - goto out_free; 478 - } 474 + inode_to_wb(inode) == isw->new_wb) 475 + goto out_unlock; 476 + 477 + if (!atomic_inc_not_zero(&inode->i_sb->s_active)) 478 + goto out_unlock; 479 + 479 480 inode->i_state |= I_WB_SWITCH; 480 481 spin_unlock(&inode->i_lock); 481 482 ··· 494 489 call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn); 495 490 return; 496 491 492 + out_unlock: 493 + spin_unlock(&inode->i_lock); 497 494 out_free: 498 495 if (isw->new_wb) 499 496 wb_put(isw->new_wb);
+6
fs/inode.c
··· 154 154 inode->i_rdev = 0; 155 155 inode->dirtied_when = 0; 156 156 157 + #ifdef CONFIG_CGROUP_WRITEBACK 158 + inode->i_wb_frn_winner = 0; 159 + inode->i_wb_frn_avg_time = 0; 160 + inode->i_wb_frn_history = 0; 161 + #endif 162 + 157 163 if (security_inode_alloc(inode)) 158 164 goto out; 159 165 spin_lock_init(&inode->i_lock);
+4
include/linux/lightnvm.h
··· 135 135 /* Memory types */ 136 136 NVM_ID_FMTYPE_SLC = 0, 137 137 NVM_ID_FMTYPE_MLC = 1, 138 + 139 + /* Device capabilities */ 140 + NVM_ID_DCAP_BBLKMGMT = 0x1, 141 + NVM_UD_DCAP_ECC = 0x2, 138 142 }; 139 143 140 144 struct nvm_id_lp_mlc {