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

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

Pull block fixes from Jens Axboe:
"I wasn't going to send this one off so soon, but unfortunately one of
the fixes from the previous pull broke the build on some archs. So I'm
sending this sooner rather than later. This contains:

- Add highmem.h include for io_uring, because of the kmap() additions
from last round. For some reason the build bot didn't spot this
even though it sat for days.

- Three minor ';' removals

- Add support for the Beurer CD-on-a-chip device

- Make io_uring work on MMU-less archs"

* tag 'for-linus-20191129' of git://git.kernel.dk/linux-block:
io_uring: fix missing kmap() declaration on powerpc
ataflop: Remove unneeded semicolon
block: sunvdc: Remove unneeded semicolon
drbd: Remove unneeded semicolon
io_uring: add mapping support for NOMMU archs
sr_vendor: support Beurer GL50 evo CD-on-a-chip devices.
cdrom: respect device capabilities during opening action

+84 -10
+1 -1
drivers/block/ataflop.c
··· 857 857 } 858 858 859 859 if (ATARIHW_PRESENT(FDCSPEED)) 860 - dma_wd.fdc_speed = 0; /* always seek with 8 Mhz */; 860 + dma_wd.fdc_speed = 0; /* always seek with 8 Mhz */ 861 861 DPRINT(("fd_calibrate\n")); 862 862 SET_IRQ_HANDLER( fd_calibrate_done ); 863 863 /* we can't verify, since the speed may be incorrect */
+1 -1
drivers/block/drbd/drbd_req.c
··· 884 884 start_new_tl_epoch(connection); 885 885 mod_rq_state(req, m, 0, RQ_NET_OK|RQ_NET_DONE); 886 886 break; 887 - }; 887 + } 888 888 889 889 return rv; 890 890 }
+1 -1
drivers/block/sunvdc.c
··· 634 634 case VD_OP_GET_EFI: 635 635 case VD_OP_SET_EFI: 636 636 return -EOPNOTSUPP; 637 - }; 637 + } 638 638 639 639 map_perm |= LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_IO; 640 640
+11 -1
drivers/cdrom/cdrom.c
··· 996 996 tracks->xa = 0; 997 997 tracks->error = 0; 998 998 cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); 999 + 1000 + if (!CDROM_CAN(CDC_PLAY_AUDIO)) { 1001 + tracks->error = CDS_NO_INFO; 1002 + return; 1003 + } 1004 + 999 1005 /* Grab the TOC header so we can see how many tracks there are */ 1000 1006 ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header); 1001 1007 if (ret) { ··· 1168 1162 ret = open_for_data(cdi); 1169 1163 if (ret) 1170 1164 goto err; 1171 - cdrom_mmc3_profile(cdi); 1165 + if (CDROM_CAN(CDC_GENERIC_PACKET)) 1166 + cdrom_mmc3_profile(cdi); 1172 1167 if (mode & FMODE_WRITE) { 1173 1168 ret = -EROFS; 1174 1169 if (cdrom_open_write(cdi)) ··· 2889 2882 it doesn't give enough information or fails. then we return 2890 2883 the toc contents. */ 2891 2884 use_toc: 2885 + if (!CDROM_CAN(CDC_PLAY_AUDIO)) 2886 + return -ENOSYS; 2887 + 2892 2888 toc.cdte_format = CDROM_MSF; 2893 2889 toc.cdte_track = CDROM_LEADOUT; 2894 2890 if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc)))
+18
drivers/scsi/sr_vendor.c
··· 61 61 #define VENDOR_NEC 2 62 62 #define VENDOR_TOSHIBA 3 63 63 #define VENDOR_WRITER 4 /* pre-scsi3 writers */ 64 + #define VENDOR_CYGNAL_85ED 5 /* CD-on-a-chip */ 64 65 65 66 #define VENDOR_TIMEOUT 30*HZ 66 67 ··· 100 99 } else if (!strncmp(vendor, "TOSHIBA", 7)) { 101 100 cd->vendor = VENDOR_TOSHIBA; 102 101 102 + } else if (!strncmp(vendor, "Beurer", 6) && 103 + !strncmp(model, "Gluco Memory", 12)) { 104 + /* The Beurer GL50 evo uses a Cygnal-manufactured CD-on-a-chip 105 + that only accepts a subset of SCSI commands. Most of the 106 + not-implemented commands are fine to fail, but a few, 107 + particularly around the MMC or Audio commands, will put the 108 + device into an unrecoverable state, so they need to be 109 + avoided at all costs. 110 + */ 111 + cd->vendor = VENDOR_CYGNAL_85ED; 112 + cd->cdi.mask |= ( 113 + CDC_MULTI_SESSION | 114 + CDC_CLOSE_TRAY | CDC_OPEN_TRAY | 115 + CDC_LOCK | 116 + CDC_GENERIC_PACKET | 117 + CDC_PLAY_AUDIO 118 + ); 103 119 } 104 120 #endif 105 121 }
+52 -6
fs/io_uring.c
··· 69 69 #include <linux/nospec.h> 70 70 #include <linux/sizes.h> 71 71 #include <linux/hugetlb.h> 72 + #include <linux/highmem.h> 72 73 73 74 #define CREATE_TRACE_POINTS 74 75 #include <trace/events/io_uring.h> ··· 4470 4469 return 0; 4471 4470 } 4472 4471 4473 - static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) 4472 + static void *io_uring_validate_mmap_request(struct file *file, 4473 + loff_t pgoff, size_t sz) 4474 4474 { 4475 - loff_t offset = (loff_t) vma->vm_pgoff << PAGE_SHIFT; 4476 - unsigned long sz = vma->vm_end - vma->vm_start; 4477 4475 struct io_ring_ctx *ctx = file->private_data; 4478 - unsigned long pfn; 4476 + loff_t offset = pgoff << PAGE_SHIFT; 4479 4477 struct page *page; 4480 4478 void *ptr; 4481 4479 ··· 4487 4487 ptr = ctx->sq_sqes; 4488 4488 break; 4489 4489 default: 4490 - return -EINVAL; 4490 + return ERR_PTR(-EINVAL); 4491 4491 } 4492 4492 4493 4493 page = virt_to_head_page(ptr); 4494 4494 if (sz > page_size(page)) 4495 - return -EINVAL; 4495 + return ERR_PTR(-EINVAL); 4496 + 4497 + return ptr; 4498 + } 4499 + 4500 + #ifdef CONFIG_MMU 4501 + 4502 + static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) 4503 + { 4504 + size_t sz = vma->vm_end - vma->vm_start; 4505 + unsigned long pfn; 4506 + void *ptr; 4507 + 4508 + ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz); 4509 + if (IS_ERR(ptr)) 4510 + return PTR_ERR(ptr); 4496 4511 4497 4512 pfn = virt_to_phys(ptr) >> PAGE_SHIFT; 4498 4513 return remap_pfn_range(vma, vma->vm_start, pfn, sz, vma->vm_page_prot); 4499 4514 } 4515 + 4516 + #else /* !CONFIG_MMU */ 4517 + 4518 + static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) 4519 + { 4520 + return vma->vm_flags & (VM_SHARED | VM_MAYSHARE) ? 0 : -EINVAL; 4521 + } 4522 + 4523 + static unsigned int io_uring_nommu_mmap_capabilities(struct file *file) 4524 + { 4525 + return NOMMU_MAP_DIRECT | NOMMU_MAP_READ | NOMMU_MAP_WRITE; 4526 + } 4527 + 4528 + static unsigned long io_uring_nommu_get_unmapped_area(struct file *file, 4529 + unsigned long addr, unsigned long len, 4530 + unsigned long pgoff, unsigned long flags) 4531 + { 4532 + void *ptr; 4533 + 4534 + ptr = io_uring_validate_mmap_request(file, pgoff, len); 4535 + if (IS_ERR(ptr)) 4536 + return PTR_ERR(ptr); 4537 + 4538 + return (unsigned long) ptr; 4539 + } 4540 + 4541 + #endif /* !CONFIG_MMU */ 4500 4542 4501 4543 SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, 4502 4544 u32, min_complete, u32, flags, const sigset_t __user *, sig, ··· 4610 4568 .release = io_uring_release, 4611 4569 .flush = io_uring_flush, 4612 4570 .mmap = io_uring_mmap, 4571 + #ifndef CONFIG_MMU 4572 + .get_unmapped_area = io_uring_nommu_get_unmapped_area, 4573 + .mmap_capabilities = io_uring_nommu_mmap_capabilities, 4574 + #endif 4613 4575 .poll = io_uring_poll, 4614 4576 .fasync = io_uring_fasync, 4615 4577 };