From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbbEGHmM (ORCPT ); Thu, 7 May 2015 03:42:12 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:36817 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbbEGHmI (ORCPT ); Thu, 7 May 2015 03:42:08 -0400 Date: Thu, 7 May 2015 16:41:59 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Sergey Senozhatsky , Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org Subject: Re: [PATCHv4 00/10] add on-demand device creation Message-ID: <20150507074159.GA3624@blaptop> References: <1430743142-15854-1-git-send-email-sergey.senozhatsky@gmail.com> <20150506050114.GA29132@blaptop> <20150506052557.GA820@swordfish> <20150506070756.GC820@swordfish> <20150506072656.GA8163@blaptop> <20150506081029.GA8385@swordfish> <20150506082036.GB8163@blaptop> <20150507003322.GA4153@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150507003322.GA4153@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 Thu, May 07, 2015 at 09:33:22AM +0900, Sergey Senozhatsky wrote: > On (05/06/15 17:20), Minchan Kim wrote: > > I'm fine, too. > > > > > > > > > > > > > > can you please test this patch? > > > > I tested it and couldn't reproduce it during 5 minutes so it seems > > we are correct about culpit. > > However, it's trick and we should find a right way. :) > > > > well, I can't reproduce this race. > > btw, just for info. your script does > > zram_add > dd & > zram_remove > > by the time dd starts writing zramX device may be gone, so along with > block devices we can see regular files in /dev/ > > [..] > brw-rw---- 1 root disk 254, 0 May 7 09:16 /dev/zram0 > -rw-r--r-- 1 root root 10485760 May 7 09:17 /dev/zram1 > -rw-r--r-- 1 root root 10485760 May 7 09:20 /dev/zram10 > [..] > > > can you please test thit patch? Hello Sergey, Unfortunately, I can reproduce in a few second with this patch. > > --- > > drivers/block/zram/zram_drv.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index e6c4316..1e99d9f 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1278,6 +1278,8 @@ out_free_dev: > static int zram_remove(struct zram *zram) > { > struct block_device *bdev; > + struct request_queue *q; > + int device_id; > > bdev = bdget_disk(zram->disk, 0); > if (!bdev) > @@ -1306,14 +1308,18 @@ static int zram_remove(struct zram *zram) > /* Make sure all the pending I/O are finished */ > fsync_bdev(bdev); > zram_reset_device(zram); > - bdput(bdev); > + > + q = zram->disk->queue; > + device_id = zram->disk->first_minor; > > pr_info("Removed device: %s\n", zram->disk->disk_name); > > - idr_remove(&zram_index_idr, zram->disk->first_minor); > - blk_cleanup_queue(zram->disk->queue); > del_gendisk(zram->disk); > put_disk(zram->disk); > + blk_cleanup_queue(q); > + bdput(bdev); > + > + idr_remove(&zram_index_idr, device_id); > kfree(zram); > return 0; > } -- Kind regards, Minchan Kim