Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jan 22, 2022
  2. Jan 20, 2022
  3. Jan 18, 2022
  4. Jan 17, 2022
  5. Jan 15, 2022
  6. Jan 13, 2022
  7. Jan 09, 2022
    • Ming Lei's avatar
      block: don't protect submit_bio_checks by q_usage_counter · 9d497e29
      Ming Lei authored
      Commit cc9c884d
      
       ("block: call submit_bio_checks under q_usage_counter")
      uses q_usage_counter to protect submit_bio_checks for avoiding IO after
      disk is deleted by del_gendisk().
      
      Turns out the protection isn't necessary, because once
      blk_mq_freeze_queue_wait() in del_gendisk() returns:
      
      1) all in-flight IO has been done
      
      2) all new IO will be failed in __bio_queue_enter() because
         q_usage_counter is dead, and GD_DEAD is set
      
      3) both disk and request queue instance are safe since caller of
      submit_bio() guarantees that the disk can't be closed.
      
      Once submit_bio_checks() needn't the protection of q_usage_counter, we can
      move submit_bio_checks before calling blk_mq_submit_bio() and
      ->submit_bio(). With this change, we needn't to throttle queue with
      holding one allocated request, then precise driver tag or request won't be
      wasted in throttling. Meantime we can unify the bio check for both bio
      based and request based driver.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20220104134223.590803-1-ming.lei@redhat.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      9d497e29
  8. Dec 23, 2021
  9. Dec 22, 2021
    • Alan Stern's avatar
      scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume() · 6e1fcab0
      Alan Stern authored
      John Garry reported a deadlock that occurs when trying to access a
      runtime-suspended SATA device.  For obscure reasons, the rescan procedure
      causes the link to be hard-reset, which disconnects the device.
      
      The rescan tries to carry out a runtime resume when accessing the device.
      scsi_rescan_device() holds the SCSI device lock and won't release it until
      it can put commands onto the device's block queue.  This can't happen until
      the queue is successfully runtime-resumed or the device is unregistered.
      But the runtime resume fails because the device is disconnected, and
      __scsi_remove_device() can't do the unregistration because it can't get the
      device lock.
      
      The best way to resolve this deadlock appears to be to allow the block
      queue to start running again even after an unsuccessful runtime resume.
      The idea is that the driver or the SCSI error handler will need to be able
      to use the queue to resolve the runtime resume failur...
      6e1fcab0
  10. Dec 21, 2021
  11. Dec 20, 2021
  12. Dec 19, 2021
  13. Dec 16, 2021
  14. Dec 14, 2021
    • Jens Axboe's avatar
      block: reduce kblockd_mod_delayed_work_on() CPU consumption · cb2ac291
      Jens Axboe authored
      
      Dexuan reports that he's seeing spikes of very heavy CPU utilization when
      running 24 disks and using the 'none' scheduler. This happens off the
      sched restart path, because SCSI requires the queue to be restarted async,
      and hence we're hammering on mod_delayed_work_on() to ensure that the work
      item gets run appropriately.
      
      Avoid hammering on the timer and just use queue_work_on() if no delay
      has been specified.
      
      Reported-and-tested-by: default avatarDexuan Cui <decui@microsoft.com>
      Link: https://lore.kernel.org/linux-block/BYAPR21MB1270C598ED214C0490F47400BF719@BYAPR21MB1270.namprd21.prod.outlook.com/
      
      
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      cb2ac291
    • Jens Axboe's avatar
      block: make queue stat accounting a reference · 68497092
      Jens Axboe authored
      
      kyber turns on IO statistics when it is loaded on a queue, which means
      that even if kyber is then later unloaded, we're still stuck with stats
      enabled on the queue.
      
      Change the account enabled from a bool to an int, and pair the enable call
      with the equivalent disable call. This ensures that stats gets turned off
      again appropriately.
      
      Reviewed-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      68497092
    • Tejun Heo's avatar
      iocost: Fix divide-by-zero on donation from low hweight cgroup · edaa2633
      Tejun Heo authored
      The donation calculation logic assumes that the donor has non-zero
      after-donation hweight, so the lowest active hweight a donating cgroup can
      have is 2 so that it can donate 1 while keeping the other 1 for itself.
      Earlier, we only donated from cgroups with sizable surpluses so this
      condition was always true. However, with the precise donation algorithm
      implemented, f1de2439 ("blk-iocost: revamp donation amount
      determination") made the donation amount calculation exact enabling even low
      hweight cgroups to donate.
      
      This means that in rare occasions, a cgroup with active hweight of 1 can
      enter donation calculation triggering the following warning and then a
      divide-by-zero oops.
      
       WARNING: CPU: 4 PID: 0 at block/blk-iocost.c:1928 transfer_surpluses.cold+0x0/0x53 [884/94867]
       ...
       RIP: 0010:transfer_surpluses.cold+0x0/0x53
       Code: 92 ff 48 c7 c7 28 d1 ab b5 65 48 8b 34 25 00 ae 01 00 48 81 c6 90 06 00 00 e8 8b 3f fe ff 48 c7 c0 ea ff ff ff e9 95...
      edaa2633
  15. Dec 13, 2021
  16. Dec 10, 2021
  17. Dec 07, 2021
    • Pavel Begunkov's avatar
      block: fix single bio async DIO error handling · 75feae73
      Pavel Begunkov authored
      BUG: KASAN: use-after-free in io_submit_one+0x496/0x2fe0 fs/aio.c:1882
      CPU: 2 PID: 15100 Comm: syz-executor873 Not tainted 5.16.0-rc1-syzk #1
      Hardware name: Red Hat KVM, BIOS 1.13.0-2.module+el8.3.0+7860+a7792d29
      04/01/2014
      Call Trace:
        [...]
        refcount_dec_and_test include/linux/refcount.h:333 [inline]
        iocb_put fs/aio.c:1161 [inline]
        io_submit_one+0x496/0x2fe0 fs/aio.c:1882
        __do_sys_io_submit fs/aio.c:1938 [inline]
        __se_sys_io_submit fs/aio.c:1908 [inline]
        __x64_sys_io_submit+0x1c7/0x4a0 fs/aio.c:1908
        do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      __blkdev_direct_IO_async() returns errors from bio_iov_iter_get_pages()
      directly, in which case upper layers won't be expecting ->ki_complete
      to be called by the block layer and will terminate the request. However,
      there is also bio_endio() leading to a second ->ki_complete and a double
      free.
      
      Fixes: 54a88eb8
      
       ("block: add single bio async direct IO helper")
      Reported-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/c9eb786f6cef041e159e6287de131bec0719ad5c.1638907997.git.asml.silence@gmail.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      75feae73
  18. Dec 06, 2021