On Wed, Oct 20, 2021 at 09:15:20AM +0800, Ming Lei wrote: > On Tue, Oct 19, 2021 at 12:36:42PM -0700, Luis Chamberlain wrote: > > On Wed, Oct 20, 2021 at 12:29:53AM +0800, Ming Lei wrote: > > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > > > index d0cae7a42f4d..a14ba3d350ea 100644 > > > --- a/drivers/block/zram/zram_drv.c > > > +++ b/drivers/block/zram/zram_drv.c > > > @@ -1704,12 +1704,12 @@ static void zram_reset_device(struct zram *zram) > > > set_capacity_and_notify(zram->disk, 0); > > > part_stat_set_all(zram->disk->part0, 0); > > > > > > - up_write(&zram->init_lock); > > > /* I/O operation under all of CPU are done so let's free */ > > > zram_meta_free(zram, disksize); > > > memset(&zram->stats, 0, sizeof(zram->stats)); > > > zcomp_destroy(comp); > > > reset_bdev(zram); > > > + up_write(&zram->init_lock); > > > } > > > > > > static ssize_t disksize_store(struct device *dev, > > > > With this, it still ends up in a state where we loop and can't get out of: > > > > zram: Can't change algorithm for initialized device > > Again, you are running two zram02.sh[1] on /dev/zram0, that isn't unexpected You mean that it is not expected? If so then yes, of course. > behavior. Here the difference is just timing. Right, but that is what helped reproduce a difficutl to re-produce customer bug. Once you find an easy way to reproduce a reported issue you stick with it and try to make the situation worse to ensure no more bugs are present. > Also you did not answer my question about your test expected result when > running the following script from two terminal concurrently: > > while true; do > PATH=$PATH:$PWD:$PWD/../../../lib/ ./zram02.sh; > done If you run this, you should see no failures. Once you start a second script that one should cause odd issues on both sides but never crash or stall the module. A second series of tests is hitting CTRL-C on either randonly and restarting testing once again randomly. Again, neither should crash the kernel or stall the module. In the end of these tests you should be able to run the script alone just once and not see issues. Luis