1. 21 Feb, 2022 4 commits
    • Mike Snitzer's avatar
      dm: eliminate copying of dm_io fields in dm_io_dec_pending · 0ab30b40
      Mike Snitzer authored
      There is no need for dm_io_dec_pending() to copy dm_io fields
      anymore now that DM provides its own pending_io counters again.
      
      The race documented in commit d208b894 ("dm: fix mempool NULL
      pointer race when completing IO") no longer exists now that block
      core's in_flight counters aren't used to signal all dm_io is
      complete.
      
      Also, rename {start,end}_io_acct to dm_{start,end}_io_acct.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      0ab30b40
    • Mike Snitzer's avatar
      dm stats: fix too short end duration_ns when using precise_timestamps · 0cdb90f0
      Mike Snitzer authored
      dm_stats_account_io()'s STAT_PRECISE_TIMESTAMPS support doesn't handle
      the fact that with commit b879f915 ("dm: properly fix redundant
      bio-based IO accounting") io->start_time _may_ be in the past (meaning
      the start_io_acct() was deferred until later).
      
      Add a new dm_stats_recalc_precise_timestamps() helper that will
      set/clear a new 'precise_timestamps' flag in the dm_stats struct based
      on whether any configured stats enable STAT_PRECISE_TIMESTAMPS.
      And update DM core's alloc_io() to use dm_stats_record_start() to set
      stats_aux.duration_ns if stats->precise_timestamps is true.
      
      Also, remove unused 'last_sector' and 'last_rw' members from the
      dm_stats struct.
      
      Fixes: b879f915 ("dm: properly fix redundant bio-based IO accounting")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      0cdb90f0
    • Mike Snitzer's avatar
      dm: fix double accounting of flush with data · 8d394bc4
      Mike Snitzer authored
      DM handles a flush with data by first issuing an empty flush and then
      once it completes the REQ_PREFLUSH flag is removed and the payload is
      issued.  The problem fixed by this commit is that both the empty flush
      bio and the data payload will account the full extent of the data
      payload.
      
      Fix this by factoring out dm_io_acct() and having it wrap all IO
      accounting to set the size of  bio with REQ_PREFLUSH to 0, account the
      IO, and then restore the original size.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      8d394bc4
    • Mike Snitzer's avatar
      dm: interlock pending dm_io and dm_wait_for_bios_completion · 9f6dc633
      Mike Snitzer authored
      Commit d208b894 ("dm: fix mempool NULL pointer race when
      completing IO") didn't go far enough.
      
      When bio_end_io_acct ends the count of in-flight I/Os may reach zero
      and the DM device may be suspended. There is a possibility that the
      suspend races with dm_stats_account_io.
      
      Fix this by adding percpu "pending_io" counters to track outstanding
      dm_io. Move kicking of suspend queue to dm_io_dec_pending(). Also,
      rename md_in_flight_bios() to dm_in_flight_bios() and update it to
      iterate all pending_io counters.
      
      Fixes: d208b894 ("dm: fix mempool NULL pointer race when completing IO")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      9f6dc633
  2. 17 Feb, 2022 20 commits
  3. 15 Feb, 2022 3 commits
  4. 11 Feb, 2022 5 commits
  5. 08 Feb, 2022 2 commits
  6. 04 Feb, 2022 6 commits