12 Jul, 2016

1 commit

  • userspace application can send READ_SUB_CHANNEL command with time bit
    enabled and disabled. The time bit allows selection of address reporting
    format. If the time bit is disabled the response is in logical block
    address(CDROM_LBA) format, represented as a 32-bit integer with ms-byte
    first. If the time bit is enabled the response is in time format i.e.,
    minutes, second, frame (CDROM_MSF) format.

    Signed-off-by: vchannaiah
    Signed-off-by: Mahendran Kuppusamy
    [veeraiyan.chidambaram@in.bosch.com: updated Documentation/ioctl/cdrom.txt]
    Signed-off-by: Veeraiyan Chidambaram
    Signed-off-by: Jens Axboe

    vchannaiah
     

06 Jan, 2016

1 commit


25 Sep, 2015

1 commit

  • Recently, i bought a blu-ray writer and noticed that while cdrecord
    worked perfectly, random writing didn't work on rewritable bd-re media.
    For example, dd if=/dev/zero of=/dev/sr0 bs=32768 count=2 gave the usual
    "read-only file system" message.

    After checking if the problem lies with my burner or firmware, i grep-ed
    the kernel source for EROFS. One of the results was in the cdrom driver.

    I tried to follow the function chain and ended in the cdrom_is_dvd_rw
    function where writing is permitted only for DVD-RAM and DVD+RW media.
    I added a new case label for 0x43 which is the profile name of BD-RE
    and now it works correctly for BD-RE too.

    Maybe there is a better way of implementing this, like a new function
    checking for blu-ray support and called from cdrom_open_write like
    it happens for mrw and dvdram media, but adding the case label worked.

    Thank you for your time.

    Signed-off-by: Jens Axboe

    Georgios Toptsidis
     

29 Aug, 2014

1 commit

  • The blk_get_request function may fail in low-memory conditions or during
    device removal (even if __GFP_WAIT is set). To distinguish between these
    errors, modify the blk_get_request call stack to return the appropriate
    ERR_PTR. Verify that all callers check the return status and consider
    IS_ERR instead of a simple NULL pointer check.

    For consistency, make a similar change to the blk_mq_alloc_request leg
    of blk_get_request. It may fail if the queue is dead, or the caller was
    unwilling to wait.

    Signed-off-by: Joe Lawrence
    Acked-by: Jiri Kosina [for pktdvd]
    Acked-by: Boaz Harrosh [for osd]
    Reviewed-by: Jeff Moyer
    Signed-off-by: Jens Axboe

    Joe Lawrence
     

11 Jun, 2014

1 commit

  • Pull block layer fixes from Jens Axboe:
    "Final small batch of fixes to be included before -rc1. Some general
    cleanups in here as well, but some of the blk-mq fixes we need for the
    NVMe conversion and/or scsi-mq. The pull request contains:

    - Support for not merging across a specified "chunk size", if set by
    the driver. Some NVMe devices perform poorly for IO that crosses
    such a chunk, so we need to support it generically as part of
    request merging avoid having to do complicated split logic. From
    me.

    - Bump max tag depth to 10Ki tags. Some scsi devices have a huge
    shared tag space. Before we failed with EINVAL if a too large tag
    depth was specified, now we truncate it and pass back the actual
    value. From me.

    - Various blk-mq rq init fixes from me and others.

    - A fix for enter on a dying queue for blk-mq from Keith. This is
    needed to prevent oopsing on hot device removal.

    - Fixup for blk-mq timer addition from Ming Lei.

    - Small round of performance fixes for mtip32xx from Sam Bradshaw.

    - Minor stack leak fix from Rickard Strandqvist.

    - Two __init annotations from Fabian Frederick"

    * 'for-linus' of git://git.kernel.dk/linux-block:
    block: add __init to blkcg_policy_register
    block: add __init to elv_register
    block: ensure that bio_add_page() always accepts a page for an empty bio
    blk-mq: add timer in blk_mq_start_request
    blk-mq: always initialize request->start_time
    block: blk-exec.c: Cleaning up local variable address returnd
    mtip32xx: minor performance enhancements
    blk-mq: ->timeout should be cleared in blk_mq_rq_ctx_init()
    blk-mq: don't allow queue entering for a dying queue
    blk-mq: bump max tag depth to 10K tags
    block: add blk_rq_set_block_pc()
    block: add notion of a chunk size for request merging

    Linus Torvalds
     

07 Jun, 2014

1 commit


06 Jun, 2014

1 commit

  • With the optimizations around not clearing the full request at alloc
    time, we are leaving some of the needed init for REQ_TYPE_BLOCK_PC
    up to the user allocating the request.

    Add a blk_rq_set_block_pc() that sets the command type to
    REQ_TYPE_BLOCK_PC, and properly initializes the members associated
    with this type of request. Update callers to use this function instead
    of manipulating rq->cmd_type directly.

    Includes fixes from Christoph Hellwig for my half-assed
    attempt.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

06 May, 2014

12 commits


17 Apr, 2014

1 commit

  • The friendly Intel kbuild test robot reported:

    drivers/cdrom/gdrom.c: In function 'gdrom_readdisk_dma':
    drivers/cdrom/gdrom.c:605:3: error: 'struct request' has no member named 'buffer'

    Convert that from req->buffer to bio_data(rq->bio). Apparently
    my grep missed this one, and I don't build for Sega Dreamcast
    enough.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

31 Jan, 2014

1 commit

  • Pull block IO driver changes from Jens Axboe:

    - bcache update from Kent Overstreet.

    - two bcache fixes from Nicholas Swenson.

    - cciss pci init error fix from Andrew.

    - underflow fix in the parallel IDE pg_write code from Dan Carpenter.
    I'm sure the 1 (or 0) users of that are now happy.

    - two PCI related fixes for sx8 from Jingoo Han.

    - floppy init fix for first block read from Jiri Kosina.

    - pktcdvd error return miss fix from Julia Lawall.

    - removal of IRQF_SHARED from the SEGA Dreamcast CD-ROM code from
    Michael Opdenacker.

    - comment typo fix for the loop driver from Olaf Hering.

    - potential oops fix for null_blk from Raghavendra K T.

    - two fixes from Sam Bradshaw (Micron) for the mtip32xx driver, fixing
    an OOM problem and a problem with handling security locked conditions

    * 'for-3.14/drivers' of git://git.kernel.dk/linux-block: (47 commits)
    mg_disk: Spelling s/finised/finished/
    null_blk: Null pointer deference problem in alloc_page_buffers
    mtip32xx: Correctly handle security locked condition
    mtip32xx: Make SGL container per-command to eliminate high order dma allocation
    drivers/block/loop.c: fix comment typo in loop_config_discard
    drivers/block/cciss.c:cciss_init_one(): use proper errnos
    drivers/block/paride/pg.c: underflow bug in pg_write()
    drivers/block/sx8.c: remove unnecessary pci_set_drvdata()
    drivers/block/sx8.c: use module_pci_driver()
    floppy: bail out in open() if drive is not responding to block0 read
    bcache: Fix auxiliary search trees for key size > cacheline size
    bcache: Don't return -EINTR when insert finished
    bcache: Improve bucket_prio() calculation
    bcache: Add bch_bkey_equal_header()
    bcache: update bch_bkey_try_merge
    bcache: Move insert_fixup() to btree_keys_ops
    bcache: Convert sorting to btree_keys
    bcache: Convert debug code to btree_keys
    bcache: Convert btree_iter to struct btree_keys
    bcache: Refactor bset_tree sysfs stats
    ...

    Linus Torvalds
     

04 Dec, 2013

2 commits


04 Jul, 2013

2 commits

  • In drivers/cdrom/cdrom.c mmc_ioctl_cdrom_read_data() allocates a memory
    area with kmalloc in line 2885.

    2885 cgc->buffer = kmalloc(blocksize, GFP_KERNEL);
    2886 if (cgc->buffer == NULL)
    2887 return -ENOMEM;

    In line 2908 we can find the copy_to_user function:

    2908 if (!ret && copy_to_user(arg, cgc->buffer, blocksize))

    The cgc->buffer is never cleaned and initialized before this function.
    If ret = 0 with the previous basic block, it's possible to display some
    memory bytes in kernel space from userspace.

    When we read a block from the disk it normally fills the ->buffer but if
    the drive is malfunctioning there is a chance that it would only be
    partially filled. The result is an leak information to userspace.

    Signed-off-by: Dan Carpenter
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jonathan Salwan
     
  • Without this patch, gdrom_major will leak when gd.cd_info alloc fails.

    Signed-off-by: Libo Chen
    Cc: Jens Axboe
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Libo Chen
     

07 May, 2013

1 commit


04 Jan, 2013

1 commit

  • CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
    markings need to be removed.

    This change removes the use of __devinit, __devexit_p, __devinitdata,
    __devinitconst, and __devexit from these drivers.

    Based on patches originally written by Bill Pemberton, but redone by me
    in order to handle some of the coding style issues better, by hand.

    Cc: Bill Pemberton
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

21 Aug, 2012

1 commit

  • flush[_delayed]_work_sync() are now spurious. Mark them deprecated
    and convert all users to flush[_delayed]_work().

    If you're cc'd and wondering what's going on: Now all workqueues are
    non-reentrant and the regular flushes guarantee that the work item is
    not pending or running on any CPU on return, so there's no reason to
    use the sync flushes at all and they're going away.

    This patch doesn't make any functional difference.

    Signed-off-by: Tejun Heo
    Cc: Russell King
    Cc: Paul Mundt
    Cc: Ian Campbell
    Cc: Jens Axboe
    Cc: Mattia Dongili
    Cc: Kent Yoder
    Cc: David Airlie
    Cc: Jiri Kosina
    Cc: Karsten Keil
    Cc: Bryan Wu
    Cc: Benjamin Herrenschmidt
    Cc: Alasdair Kergon
    Cc: Mauro Carvalho Chehab
    Cc: Florian Tobias Schandinat
    Cc: David Woodhouse
    Cc: "David S. Miller"
    Cc: linux-wireless@vger.kernel.org
    Cc: Anton Vorontsov
    Cc: Sangbeom Kim
    Cc: "James E.J. Bottomley"
    Cc: Greg Kroah-Hartman
    Cc: Eric Van Hensbergen
    Cc: Takashi Iwai
    Cc: Steven Whitehouse
    Cc: Petr Vandrovec
    Cc: Mark Fasheh
    Cc: Christoph Hellwig
    Cc: Avi Kivity

    Tejun Heo
     

16 Mar, 2012

1 commit


09 Feb, 2012

1 commit

  • The keeplocked variable in the cdrom driver is shared across multiple
    drives, but set in per-device ioctls. Move it to the per-device struct,
    avoiding that the setting on one drive affects the driver's behavior
    when closing another.

    [ Impact: limit udev's confusion to one drive when a CD burning program
    unlocks the CD door at the end of burning. ]

    Signed-off-by: Paolo Bonzini
    Signed-off-by: Jens Axboe

    Paolo Bonzini
     

06 Feb, 2012

1 commit

  • "nframes" comes from the user and "nframes * CD_FRAMESIZE_RAW" can wrap
    on 32 bit systems. That would have been ok if we used the same wrapped
    value for the copy, but we use a shifted value. We should just use the
    checked version of copy_to_user() because it's not going to make a
    difference to the speed.

    Cc: stable@vger.kernel.com
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jens Axboe

    Dan Carpenter
     

15 Jan, 2012

1 commit

  • Introduce a wrapper around scsi_cmd_ioctl that takes a block device.

    The function will then be enhanced to detect partition block devices
    and, in that case, subject the ioctls to whitelisting.

    Cc: linux-scsi@vger.kernel.org
    Cc: Jens Axboe
    Cc: James Bottomley
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Linus Torvalds

    Paolo Bonzini
     

13 Jan, 2012

1 commit


04 Jan, 2012

1 commit

  • Move invalidate_bdev, block_sync_page into fs/block_dev.c. Export
    kill_bdev as well, so brd doesn't have to open code it. Reduce
    buffer_head.h requirement accordingly.

    Removed a rather large comment from invalidate_bdev, as it looked a bit
    obsolete to bother moving. The small comment replacing it says enough.

    Signed-off-by: Nick Piggin
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Al Viro
     

02 Aug, 2011

1 commit

  • The report has an ISO which has a very long manufacturer ID. It seems
    that Linux is wrong, not the ISO maker.

    Relax the check for the length of this field: emit a warning and truncate
    the incoming data to 2048 bytes rather than rejecting the entire thing.

    dvd_manufact.value isn't null-terminated. I'm not even sure if it's a
    string. The kernel doesn't apepar to use it anyway.

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=39062

    Reported-by:
    Tested-by:
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Jens Axboe

    Andrew Morton
     

02 Jun, 2011

1 commit

  • Jens' back-merge commit 698567f3fa79 ("Merge commit 'v2.6.39' into
    for-2.6.40/core") was incorrectly done, and re-introduced the
    DISK_EVENT_MEDIA_CHANGE lines that had been removed earlier in commits

    - 9fd097b14918 ("block: unexport DISK_EVENT_MEDIA_CHANGE for
    legacy/fringe drivers")

    - 7eec77a1816a ("ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd
    and ide-cd")

    because of conflicts with the "g->flags" updates near-by by commit
    d4dc210f69bc ("block: don't block events on excl write for non-optical
    devices")

    As a result, we re-introduced the hanging behavior due to infinite disk
    media change reports.

    Tssk, tssk, people! Don't do back-merges at all, and *definitely* don't
    do them to hide merge conflicts from me - especially as I'm likely
    better at merging them than you are, since I do so many merges.

    Reported-by: Steven Rostedt
    Cc: Jens Axboe
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

21 May, 2011

1 commit

  • Since for-2.6.40/core was forked off the 2.6.39 devel tree, we've
    had churn in the core area that makes it difficult to handle
    patches for eg cfq or blk-throttle. Instead of requiring that they
    be based in older versions with bugs that have been fixed later
    in the rc cycle, merge in 2.6.39 final.

    Also fixes up conflicts in the below files.

    Conflicts:
    drivers/block/paride/pcd.c
    drivers/cdrom/viocd.c
    drivers/ide/ide-cd.c

    Signed-off-by: Jens Axboe

    Jens Axboe
     

29 Apr, 2011

1 commit

  • cdrom_open() called check_disk_change() after the rest of open path
    succeeded which leads to the following bizarre behavior.

    * After media change, if the device opened without O_NONBLOCK,
    open_for_data() naturally fails with -ENOMEDIA and
    check_disk_change() is never called. The media is known to be gone
    and the open failure makes it obvious to the userland but device
    invalidation never happens.

    * But if the device is opened with O_NONBLOCK, all the checks are
    bypassed and cdrom_open() doesn't notice that the media is not there
    and check_disk_change() is called and invalidation happens.

    There's nothing to be gained by avoiding calling check_disk_change()
    on open failure. Common cases end up calling check_disk_change()
    anyway. All we get is inconsistent behavior.

    Fix it by moving check_disk_change() invocation to the top of
    cdrom_open() so that it always gets called regardless of how the rest
    of open proceeds.

    Stable: 2.6.38

    Signed-off-by: Tejun Heo
    Reported-by: Amit Shah
    Tested-by: Amit Shah
    Cc: stable@kernel.org
    Signed-off-by: Jens Axboe

    Tejun Heo
     

22 Apr, 2011

2 commits

  • In-kernel disk event polling doesn't matter for legacy/fringe drivers
    and may lead to infinite event loop if ->check_events() implementation
    generates events on level condition instead of edge.

    Now that block layer supports suppressing exporting unlisted events,
    simply leaving disk->events cleared allows these drivers to keep the
    internal revalidation behavior intact while avoiding weird
    interactions with userland event handler.

    Signed-off-by: Tejun Heo
    Cc: Kay Sievers
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Disk event code automatically blocks events on excl write. This is
    primarily to avoid issuing polling commands while burning is in
    progress. This behavior doesn't fit other types of devices with
    removeable media where polling commands don't have adverse side
    effects and door locking usually doesn't exist.

    This patch introduces new genhd flag which controls the auto-blocking
    behavior and uses it to enable auto-blocking only on optical devices.

    Note for stable: 2.6.38 and later only

    Cc: stable@kernel.org
    Signed-off-by: Tejun Heo
    Reported-by: Kay Sievers
    Signed-off-by: Jens Axboe

    Tejun Heo