[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1304161506580.24453@file.rdu.redhat.com>
Date: Tue, 16 Apr 2013 15:41:23 -0400 (EDT)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Tejun Heo <tj@...nel.org>
cc: Vivek Goyal <vgoyal@...hat.com>, Jens Axboe <axboe@...nel.dk>,
Mike Snitzer <snitzer@...hat.com>,
Milan Broz <gmazyland@...il.com>, dm-devel@...hat.com,
Andi Kleen <andi@...stfloor.org>, dm-crypt@...ut.de,
linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Christian Schmidt <schmidt@...add.de>,
"Alasdair G. Kergon" <agk@...hat.com>
Subject: Re: [PATCH v2] make dm and dm-crypt forward cgroup context (was:
dm-crypt parallelization patches)
On Tue, 16 Apr 2013, Tejun Heo wrote:
> Hey,
>
> On Mon, Apr 15, 2013 at 09:02:06AM -0400, Mikulas Patocka wrote:
> > The patch is not bug-prone, because we already must make sure that the
> > cloned bio has shorter lifetime than the master bio - so the patch doesn't
> > introduce any new possibilities to make bugs.
>
> The whole world isn't composed of only your code. As I said
> repeatedly, you're introducing an API which is misleading and can
> easily cause subtle bugs which are very difficult to reproduce.
>
> Imagine it being used to tag a metatdata or checksum update bio being
> sent down while processing another bio and used to "clone" the context
> of the original bio. It'll work most of the time even if the original
> bio gets completed first but it'll break when it gets really unlucky -
> e.g. racing with other operations which can put the base css ref, and
> it'll be hellish to reproduce and everyone would have to pay for your
> silly hack.
That's why the comment at the function says: "it is assumed that the
lifestime of the new bio is shorter than the lifetime of the original bio.
If the new bio can outlive the old bio, the caller must increment the
reference counts." - do you think that it is so bad that someone will use
the function without reading the comment?
Anyway, the situation that you describe could only happen in dm-bufio or
dm-kcopyd files, so it's easy to control and increment the reference
counts there. There are no other places in device mapper where we create
bios that live longer than original one.
Mikulas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists