From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031499AbbD2HXO (ORCPT ); Wed, 29 Apr 2015 03:23:14 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33766 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753419AbbD2HXL (ORCPT ); Wed, 29 Apr 2015 03:23:11 -0400 Date: Wed, 29 Apr 2015 16:23:28 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: Re: [PATCHv3 9/9] zram: add dynamic device add/remove functionality Message-ID: <20150429072328.GA2987@swordfish> References: <1430140911-7818-1-git-send-email-sergey.senozhatsky@gmail.com> <1430140911-7818-10-git-send-email-sergey.senozhatsky@gmail.com> <20150429001624.GA3917@swordfish> <20150429064858.GA5125@blaptop> <20150429070218.GA616@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150429070218.GA616@swordfish> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (04/29/15 16:02), Sergey Senozhatsky wrote: > 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 > I'll take a look later today. currently I think of something like: sysfs_remove_group() lock ->bd_mutex ... check ->bd_openers zram_reset_device() blk_cleanup_queue() del_gendisk() put_disk() unlock ->bd_mutex bdput bdev idr_remove() kfree(zram) iow, idr_remove() and kfree() are done outside of ->bd_mutex lock. but I may be wrong. haven't tested yet. but seems reasonable: we invalidate ->bdev, delete partitions, etc., holding ->bd_mutex and then release ->bdev, which does final put. need to check that in detail. -ss