From patchwork Sat Sep 12 19:58:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 47104 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8CJwrfZ028435 for ; Sat, 12 Sep 2009 19:58:53 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 4DB2C6194A6; Sat, 12 Sep 2009 15:58:52 -0400 (EDT) Received: from int-mx03.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n8CJwp9Y031618 for ; Sat, 12 Sep 2009 15:58:51 -0400 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.13]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8CJwoE5011998 for ; Sat, 12 Sep 2009 15:58:50 -0400 Received: from kernel.dk (brick.kernel.dk [93.163.65.50]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8CJweA9031595 for ; Sat, 12 Sep 2009 15:58:40 -0400 Received: by kernel.dk (Postfix, from userid 1000) id 132D237A094; Sat, 12 Sep 2009 21:58:40 +0200 (CEST) Date: Sat, 12 Sep 2009 21:58:40 +0200 From: Jens Axboe To: Sebastian Andrzej Siewior Message-ID: <20090912195839.GG14984@kernel.dk> References: <20090912111928.GA8013@Chamillionaire.breakpoint.cc> <20090912195212.GF14984@kernel.dk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090912195212.GF14984@kernel.dk> X-RedHat-Spam-Score: -100.82 (AWL,DNS_FROM_RFC_BOGUSMX,USER_IN_WHITELIST) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.13 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org Subject: [dm-devel] Re: recent bdi changes result in WARN_ON on luksClose / dm X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com On Sat, Sep 12 2009, Jens Axboe wrote: > On Sat, Sep 12 2009, Sebastian Andrzej Siewior wrote: > > | Orion:/# cryptsetup luksClose crypto > > |------------[ cut here ]------------ > > |WARNING: at /home/bigeasy/git/cryptodev-2.6/mm/backing-dev.c:637 bdi_destroy+0x44/0x60() > > |Modules linked in: cbc sha256_generic dm_crypt [last unloaded: mv_cesa] > > |[] (unwind_backtrace+0x0/0xdc) from [] (warn_slowpath_common+0x4c/0x80) > > |[] (warn_slowpath_common+0x4c/0x80) from [] (bdi_destroy+0x44/0x60) > > |[] (bdi_destroy+0x44/0x60) from [] (blk_release_queue+0x3c/0x54) > > |[] (blk_release_queue+0x3c/0x54) from [] (kobject_release+0x5c/0x74) > > |[] (kobject_release+0x5c/0x74) from [] (kref_put+0x68/0x7c) > > |[] (kref_put+0x68/0x7c) from [] (dm_put+0x148/0x178) > > |[] (dm_put+0x148/0x178) from [] (dev_remove+0x98/0xb4) > > |[] (dev_remove+0x98/0xb4) from [] (dm_ctl_ioctl+0x21c/0x29c) > > |[] (dm_ctl_ioctl+0x21c/0x29c) from [] (vfs_ioctl+0x2c/0x8c) > > |[] (vfs_ioctl+0x2c/0x8c) from [] (do_vfs_ioctl+0x524/0x590) > > |[] (do_vfs_ioctl+0x524/0x590) from [] (sys_ioctl+0x38/0x5c) > > |[] (sys_ioctl+0x38/0x5c) from [] (ret_fast_syscall+0x0/0x2c) > > |---[ end trace b3c544a14b51605c ]--- > > So dm is killing the queue and associated backing device, while dirty > inodes still exist. That's not very nice. Perhaps dm_lock_for_deletion() > should ensure that the backing is flushed? Don't count this as a real fix, I'll investigate closer on monday. Does the warning go away with this hack? It'll ensure that pending dirty inodes are flushed. diff --git a/drivers/md/dm.c b/drivers/md/dm.c index b4845b1..ead4a9b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -357,6 +357,17 @@ int dm_open_count(struct mapped_device *md) return atomic_read(&md->open_count); } +static void dm_flush_dirty_io(struct mapped_device *md) +{ + struct writeback_control wbc = { + .bdi = &md->queue->backing_dev_info, + .sync_mode = WB_SYNC_ALL, + .nr_to_write = LONG_MAX, + }; + + bdi_start_writeback(&wbc); +} + /* * Guarantees nothing is using the device before it's deleted. */ @@ -373,6 +384,9 @@ int dm_lock_for_deletion(struct mapped_device *md) spin_unlock(&_minor_lock); + if (!r) + dm_flush_dirty_io(md); + return r; }