Hello Minchan,

On (04/29/15 15:48), Minchan Kim wrote:
[..]
> > 
> >     CPU0                    CPU1
> >     umount
> >     zram_remove()
> >     zram_reset_device()     disksize_store()
> >                             mount
> >     kfree zram
> > 
> > or
> > 
> >     CPU0                            CPU1
> >     umount
> >     zram_remove()
> >     zram_reset_device()
> >                                     cat /sys/block/zram0/_any_sysfs_node_
> >     sysfs_remove_group()
> >     kfree zram                      _any_sysfs_node_read()
> > 
> > 
> > and so on. so removing sysfs group before zram_reset_device() makes sense.
> > 
> > at the same time we need to prevent `umount-zram_remove vs. mount' race and 
> > forbid
> > zram_remove() on active device. so we check ->bd_openers and perform device 
> > reset
> > under ->bd_mutex.
> > 
> 
> Could you explain in detail about unmount-zram_remove vs. mount race?
> I guess it should be done in upper layer(e,g. VFS). Anyway, I want to be
> more clear about that.
> 

sure. I was talking about this one:

        CPU0                    CPU1
        umount
        zram_remove()
        lock ->bd_mutex
        zram_reset_device()
        unlock ->bd_mutex
                                disksize_store
                                mount
                                echo 'test' > /mnt/test
        kfree zram
                                zram write


w/o ->bd_mutex around zram_reset_device() it's evern simpler, I guess.
hm, I don't think VFS can help us here.

        -ss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to