1. 04 Jan, 2022 1 commit
  2. 03 Jan, 2022 1 commit
    • Song Liu's avatar
      md/raid1: fix missing bitmap update w/o WriteMostly devices · 46669e86
      Song Liu authored
      commit [1] causes missing bitmap updates when there isn't any WriteMostly
      devices.
      
      Detailed steps to reproduce by Norbert (which somehow didn't make to lore):
      
         # setup md10 (raid1) with two drives (1 GByte sparse files)
         dd if=/dev/zero of=disk1 bs=1024k seek=1024 count=0
         dd if=/dev/zero of=disk2 bs=1024k seek=1024 count=0
      
         losetup /dev/loop11 disk1
         losetup /dev/loop12 disk2
      
         mdadm --create /dev/md10 --level=1 --raid-devices=2 /dev/loop11 /dev/loop12
      
         # add bitmap (aka write-intent log)
         mdadm /dev/md10 --grow --bitmap=internal
      
         echo check > /sys/block/md10/md/sync_action
      
         root:# cat /sys/block/md10/md/mismatch_cnt
         0
         root:#
      
         # remove member drive disk2 (loop12)
         mdadm /dev/md10 -f loop12 ; mdadm /dev/md10 -r loop12
      
         # modify degraded md device
         dd if=/dev/urandom of=/dev/md10 bs=512 count=1
      
         # no blocks recorded as out of sync on the remaining member disk1/loop11
         root:# mdadm -X /dev/loop11 | grep Bitmap
                   Bitmap : 16 bits (chunks), 0 dirty (0.0%)
         root:#
      
         # re-add disk2, nothing synced because of empty bitmap
         mdadm /dev/md10 --re-add /dev/loop12
      
         # check integrity again
         echo check > /sys/block/md10/md/sync_action
      
         # disk1 and disk2 are no longer in sync, reads return differend data
         root:# cat /sys/block/md10/md/mismatch_cnt
         128
         root:#
      
         # clean up
         mdadm -S /dev/md10
         losetup -d /dev/loop11
         losetup -d /dev/loop12
         rm disk1 disk2
      
      Fix this by moving the WriteMostly check to the if condition for
      alloc_behind_master_bio().
      
      [1] commit fd3b6975 ("md/raid1: only allocate write behind bio for WriteMostly device")
      Fixes: fd3b6975 ("md/raid1: only allocate write behind bio for WriteMostly device")
      Cc: stable@vger.kernel.org # v5.12+
      Cc: Guoqing Jiang <guoqing.jiang@linux.dev>
      Cc: Jens Axboe <axboe@kernel.dk>
      Reported-by: default avatarNorbert Warmuth <nwarmuth@t-online.de>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      46669e86
  3. 19 Dec, 2021 1 commit
  4. 15 Dec, 2021 2 commits
  5. 14 Dec, 2021 1 commit
    • 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 ff 92 ff <0f> 0b 48 c7 c7 30 da ab b5 e8 71 3f fe ff 4c 89 e8 4d 85 ed 74 0
      4
       ...
       Call Trace:
        <IRQ>
        ioc_timer_fn+0x1043/0x1390
        call_timer_fn+0xa1/0x2c0
        __run_timers.part.0+0x1ec/0x2e0
        run_timer_softirq+0x35/0x70
       ...
       iocg: invalid donation weights in /a/b: active=1 donating=1 after=0
      
      Fix it by excluding cgroups w/ active hweight < 2 from donating. Excluding
      these extreme low hweight donations shouldn't affect work conservation in
      any meaningful way.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: f1de2439 ("blk-iocost: revamp donation amount determination")
      Cc: stable@vger.kernel.org # v5.10+
      Link: https://lore.kernel.org/r/Ybfh86iSvpWKxhVM@slm.duckdns.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      edaa2633
  6. 10 Dec, 2021 6 commits
  7. 08 Dec, 2021 1 commit
  8. 07 Dec, 2021 3 commits
  9. 06 Dec, 2021 4 commits
  10. 29 Nov, 2021 1 commit
  11. 26 Nov, 2021 2 commits
  12. 25 Nov, 2021 3 commits
  13. 23 Nov, 2021 10 commits
  14. 19 Nov, 2021 2 commits
  15. 17 Nov, 2021 2 commits