Skip to content
Snippets Groups Projects
  1. Mar 22, 2023
  2. Mar 17, 2023
  3. Mar 11, 2023
  4. Mar 10, 2023
  5. Feb 02, 2023
  6. Jan 31, 2023
  7. Jan 30, 2023
  8. Jan 17, 2023
  9. Jan 16, 2023
  10. Jan 09, 2023
  11. Jan 05, 2023
  12. Jan 04, 2023
  13. Dec 26, 2022
  14. Dec 25, 2022
    • Steven Rostedt (Google)'s avatar
      treewide: Convert del_timer*() to timer_shutdown*() · 292a089d
      Steven Rostedt (Google) authored
      Due to several bugs caused by timers being re-armed after they are
      shutdown and just before they are freed, a new state of timers was added
      called "shutdown".  After a timer is set to this state, then it can no
      longer be re-armed.
      
      The following script was run to find all the trivial locations where
      del_timer() or del_timer_sync() is called in the same function that the
      object holding the timer is freed.  It also ignores any locations where
      the timer->function is modified between the del_timer*() and the free(),
      as that is not considered a "trivial" case.
      
      This was created by using a coccinelle script and the following
      commands:
      
          $ cat timer.cocci
          @@
          expression ptr, slab;
          identifier timer, rfield;
          @@
          (
          -       del_timer(&ptr->timer);
          +       timer_shutdown(&ptr->timer);
          |
          -       del_timer_sync(&ptr->timer);
          +       timer_shutdown_sync(&ptr->timer);
          )
            ... when strict
                when != ptr->timer
          (
                  kfree_rcu(ptr, rfield);
          |
                  kmem_cache_free(slab, ptr);
          |
                  kfree(ptr);
          )
      
          $ spatch timer.cocci . > /tmp/t.patch
          $ patch -p1 < /tmp/t.patch
      
      Link: https://lore.kernel.org/lkml/20221123201306.823305113@linutronix.de/
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Acked-by: Pavel Machek <pavel@ucw.cz> [ LED ]
      Acked-by: Kalle Valo <kvalo@kernel.org> [ wireless ]
      Acked-by: Paolo Abeni <pabeni@redhat.com> [ networking ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      292a089d
  15. Dec 15, 2022
  16. Dec 14, 2022
    • Tejun Heo's avatar
      blk-iolatency: Fix memory leak on add_disk() failures · 813e6930
      Tejun Heo authored
      
      When a gendisk is successfully initialized but add_disk() fails such as when
      a loop device has invalid number of minor device numbers specified,
      blkcg_init_disk() is called during init and then blkcg_exit_disk() during
      error handling. Unfortunately, iolatency gets initialized in the former but
      doesn't get cleaned up in the latter.
      
      This is because, in non-error cases, the cleanup is performed by
      del_gendisk() calling rq_qos_exit(), the assumption being that rq_qos
      policies, iolatency being one of them, can only be activated once the disk
      is fully registered and visible. That assumption is true for wbt and iocost,
      but not so for iolatency as it gets initialized before add_disk() is called.
      
      It is desirable to lazy-init rq_qos policies because they are optional
      features and add to hot path overhead once initialized - each IO has to walk
      all the registered rq_qos policies. So, we want to switch iolatency to lazy
      init too. However, that's a bigger change. As a fix for the immediate
      problem, let's just add an extra call to rq_qos_exit() in blkcg_exit_disk().
      This is safe because duplicate calls to rq_qos_exit() become noop's.
      
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatar <darklight2357@icloud.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Fixes: d7067512 ("block: introduce blk-iolatency io controller")
      Cc: stable@vger.kernel.org # v4.19+
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/Y5TQ5gm3O4HXrXR3@slm.duckdns.org
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      813e6930
Loading