Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
hello, On (02/04/15 00:39), Minchan Kim wrote: > So, you mean this? > > reset_store > > down_write(>init_lock); > zram_reset_device(zram); > set_capacity(zram->disk, 0); > up_write(>init_lock); > > > If so, +1. > Hope you send a squash patch to Andrew. yes, that's

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Minchan Kim
Hello, On Wed, Feb 04, 2015 at 12:06:24AM +0900, Sergey Senozhatsky wrote: > On (02/03/15 23:52), Sergey Senozhatsky wrote: > > On (02/03/15 23:15), Sergey Senozhatsky wrote: > > > > How about keep this here? Protected by zram->init_lock. > > > >set_capacity(zram->disk, 0); > > > > >

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
On (02/03/15 23:52), Sergey Senozhatsky wrote: > On (02/03/15 23:15), Sergey Senozhatsky wrote: > > > How about keep this here? Protected by zram->init_lock. > > >set_capacity(zram->disk, 0); > > > > why? > > > yeah, I see why. good catch. > > hm, why do we perform destroy_device()

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
On (02/03/15 23:15), Sergey Senozhatsky wrote: > > How about keep this here? Protected by zram->init_lock. > >set_capacity(zram->disk, 0); > > why? > yeah, I see why. good catch. hm, why do we perform destroy_device() before zram_reset_device() in zram_exit()? how about doing

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
Hello, On (02/03/15 22:05), Ganesh Mahendran wrote: > > zram->disksize = 0; > > - if (reset_capacity) > > - set_capacity(zram->disk, 0); > > How about keep this here? Protected by zram->init_lock. >set_capacity(zram->disk, 0); why? -ss -- To

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Ganesh Mahendran
Hello, Sergey 2015-02-02 22:08 GMT+08:00 Sergey Senozhatsky : > Ganesh Mahendran was the first one who proposed to use bdev->bd_mutex > to avoid ->bd_holders race condition: > > CPU0CPU1 > umount /* zram->init_done is true */ > reset_store() > bdev->bd_holders

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
On (02/03/15 23:15), Sergey Senozhatsky wrote: How about keep this here? Protected by zram-init_lock. set_capacity(zram-disk, 0); why? yeah, I see why. good catch. hm, why do we perform destroy_device() before zram_reset_device() in zram_exit()? how about doing something like

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Minchan Kim
Hello, On Wed, Feb 04, 2015 at 12:06:24AM +0900, Sergey Senozhatsky wrote: On (02/03/15 23:52), Sergey Senozhatsky wrote: On (02/03/15 23:15), Sergey Senozhatsky wrote: How about keep this here? Protected by zram-init_lock. set_capacity(zram-disk, 0); why? yeah,

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
On (02/03/15 23:52), Sergey Senozhatsky wrote: On (02/03/15 23:15), Sergey Senozhatsky wrote: How about keep this here? Protected by zram-init_lock. set_capacity(zram-disk, 0); why? yeah, I see why. good catch. hm, why do we perform destroy_device() before

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
hello, On (02/04/15 00:39), Minchan Kim wrote: So, you mean this? reset_store down_write(zram-init_lock); zram_reset_device(zram); set_capacity(zram-disk, 0); up_write(zram-init_lock); If so, +1. Hope you send a squash patch to Andrew. yes, that's what I

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Ganesh Mahendran
Hello, Sergey 2015-02-02 22:08 GMT+08:00 Sergey Senozhatsky sergey.senozhat...@gmail.com: Ganesh Mahendran was the first one who proposed to use bdev-bd_mutex to avoid -bd_holders race condition: CPU0CPU1 umount /* zram-init_done is true */ reset_store()

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-03 Thread Sergey Senozhatsky
Hello, On (02/03/15 22:05), Ganesh Mahendran wrote: zram-disksize = 0; - if (reset_capacity) - set_capacity(zram-disk, 0); How about keep this here? Protected by zram-init_lock. set_capacity(zram-disk, 0); why? -ss -- To unsubscribe from

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-02 Thread Minchan Kim
Hello Sergey, On Mon, Feb 02, 2015 at 11:08:40PM +0900, Sergey Senozhatsky wrote: > Ganesh Mahendran was the first one who proposed to use bdev->bd_mutex > to avoid ->bd_holders race condition: > > CPU0CPU1 > umount /* zram->init_done is true */ >

Re: [PATCH] zram: fix umount-reset_store-mount race condition

2015-02-02 Thread Minchan Kim
Hello Sergey, On Mon, Feb 02, 2015 at 11:08:40PM +0900, Sergey Senozhatsky wrote: Ganesh Mahendran was the first one who proposed to use bdev-bd_mutex to avoid -bd_holders race condition: CPU0CPU1 umount /* zram-init_done is true */ reset_store()