From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932324AbbBBFSP (ORCPT ); Mon, 2 Feb 2015 00:18:15 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:45560 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752074AbbBBFSN (ORCPT ); Mon, 2 Feb 2015 00:18:13 -0500 Date: Mon, 2 Feb 2015 14:18:05 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Sergey Senozhatsky , Andrew Morton , "linux-kernel@vger.kernel.org" , Linux-MM , Nitin Gupta , Jerome Marchand , Ganesh Mahendran Subject: Re: [PATCH v1 2/2] zram: remove init_lock in zram_make_request Message-ID: <20150202051805.GI6402@blaptop> References: <20150129063505.GA32331@blaptop> <20150129070835.GD2555@swordfish> <20150130144145.GA2840@blaptop> <20150201145036.GA1290@swordfish> <20150202013028.GB6402@blaptop> <20150202014800.GA6977@swordfish> <20150202024405.GD6402@blaptop> <20150202040124.GE6977@swordfish> <20150202042847.GG6402@blaptop> <20150202050912.GA443@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150202050912.GA443@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 Mon, Feb 02, 2015 at 02:09:12PM +0900, Sergey Senozhatsky wrote: > > the patch mosly looks good, except for one place: > > On (02/02/15 13:28), Minchan Kim wrote: > > @@ -783,6 +812,8 @@ static ssize_t disksize_store(struct device *dev, > > goto out_destroy_comp; > > } > > > > + init_waitqueue_head(&zram->io_done); > > + zram_meta_get(zram); > > it was > + init_completion(&zram->io_done); > + atomic_set(&zram->refcount, 1); > > I think we need to replace zram_meta_get(zram) with atomic_set(&zram->refcount, 1). > > ->refcount is 0 by default and atomic_inc_not_zero(&zram->refcount) will not > increment it here, nor anywhere else. > > > > zram->meta = meta; > > zram->comp = comp; > > zram->disksize = disksize; > > @@ -838,8 +869,8 @@ static ssize_t reset_store(struct device *dev, > > /* Make sure all pending I/O is finished */ > > fsync_bdev(bdev); > > bdput(bdev); > > - > > [..] > > > @@ -1041,6 +1075,7 @@ static int create_device(struct zram *zram, int device_id) > > int ret = -ENOMEM; > > > > init_rwsem(&zram->init_lock); > > + atomic_set(&zram->refcount, 0); > > sorry, I forgot that zram is kzalloc()-ated. so we can drop > > atomic_set(&zram->refcount, 0) > Everything are fixed. Ready to send a patch. But before sending, hope we fix umount race issue first. Thanks a lot, Sergey! -- Kind regards, Minchan Kim