Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: util-linux (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1645846

Title:
  zramctl fails if called within a certain interval after modprobe zram.

Status in util-linux package in Ubuntu:
  Confirmed

Bug description:
  On my machine, I can trigger the bug 100% of the time if I do this:
    modprobe zram; d=$(zramctl --find) && zramctl --size 256M $d

  Here is the error message zramctl emits:
    zramctl: /dev/zram0: failed to reset: Device or resource busy

  
  However, the following always work (0% failure)!
    modprobe zram; sleep 0.1; d=$(zramctl --find) && zramctl --size 256M $d
    modprobe zram; d=$(zramctl --find) && sleep 0.1 && zramctl --size 256M $d

  
  And the following sometimes works and sometimes doesn't:
    modprobe zram; d=$(zramctl --find --size 256M)
  Chances are about 25% of failure according to this:
      for i in {0..99};
      do
        echo $i;
        modprobe -r zram;
        modprobe zram;
        d=$(zramctl --find --size 256M);
        sleep 0.05;
      done 2>&1 | grep -c failed

  Bizarrely, while putting a long sleep (0.1s) after the modprobe fixes
  the problem, putting a short sleep in (0.01s) increases the failure
  rate to 95%!

  ----------------------------------------------------------------------
      for i in {0..99};
      do
        echo $i;
        modprobe -r zram;
        modprobe zram;
        sleep 0.01                      # <-- this makes things worse!
        d=$(zramctl --find --size 256M);
        sleep 0.05;
      done 2>&1 | grep -c failed
  ----------------------------------------------------------------------
      for i in {0..99};
      do
        echo $i;
        modprobe -r zram;
        modprobe zram;
        sleep 0.10                      # <-- this completely fixes the problem
        d=$(zramctl --find --size 256M);
        sleep 0.05;
      done 2>&1 | grep -c failed
  ----------------------------------------------------------------------

  Because of the weird window of time in which this bug occurs, I assume
  it is caused by some asynchronous process briefly locking the device
  shortly after 'modprobe zram'. I'm guessing zramctl's --find part is
  running before the lock but the --size part happens while the device
  is in use.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1645846/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to