[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b023cf7a-ca86-5516-b441-30bec442dee6@suse.de>
Date: Mon, 17 Jun 2019 09:32:39 +0200
From: Hannes Reinecke <hare@...e.de>
To: Christoph Hellwig <hch@...radead.org>,
John Dorminy <jdorminy@...hat.com>
Cc: Mike Snitzer <snitzer@...hat.com>, Jens Axboe <axboe@...nel.dk>,
NeilBrown <neilb@...e.com>, linux-block@...r.kernel.org,
device-mapper development <dm-devel@...hat.com>,
Milan Broz <gmazyland@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: block: be more careful about status in __bio_chain_endio
On 6/12/19 9:01 AM, Christoph Hellwig wrote:
> On Tue, Jun 11, 2019 at 10:56:42PM -0400, John Dorminy wrote:
>> I believe the second of these might, but is not guaranteed to,
>> preserve the first error observed in a child; I believe if you want to
>> definitely save the first error you need an atomic.
>
> Is there any reason not to simply use a cmpxchg? Yes, it is a
> relatively expensive operation, but once we are chaining bios we are out
> of the super hot path anyway. We do something similar in xfs and iomap
> already.
>
Agree.
Thing is, we need to check if the parent status is NULL, _and_ the
parent status might be modified asynchronously.
So even a READ_ONCE() wouldn't cut it, as it would tell us that the
parent status _was_ NULL, not that the parent status _is_ NULL by the
time we're setting it.
So cmpxchg() is it.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@...e.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Powered by blists - more mailing lists