From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031107AbdEXQrK (ORCPT ); Wed, 24 May 2017 12:47:10 -0400 Received: from mail-yw0-f173.google.com ([209.85.161.173]:33269 "EHLO mail-yw0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934666AbdEXQrH (ORCPT ); Wed, 24 May 2017 12:47:07 -0400 Date: Wed, 24 May 2017 12:47:04 -0400 From: Tejun Heo To: Paolo Valente Cc: Jens Axboe , linux-block@vger.kernel.org, Linux-Kernal , Ulf Hansson , Linus Walleij , broonie@kernel.org Subject: Re: [PATCH BUGFIX] block, bfq: access and cache blkg data only when safe Message-ID: <20170524164704.GF24798@htj.duckdns.org> References: <20170519083908.2588-1-paolo.valente@linaro.org> <20170519145442.GA7174@wtj.duckdns.org> <20170523204239.GI13222@htj.duckdns.org> <6E15A7C4-398F-4A93-A717-C499B3900EF0@linaro.org> <20170524145023.GA24798@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Wed, May 24, 2017 at 05:43:18PM +0100, Paolo Valente wrote: > > so none of the above objects can be destroyed before the request is > > done. > > ... the issue seems just to move to a more subtle position: cfq is ok, > because it protects itself with rq lock, but blk-mq schedulers don't. > So, the race that leads to the (real) crashes reported by people may > actually be: Oh, I was just thinking about !mq paths the whole time. > 1 blkg_lookup executed on a blkg being destroyed: the scheduler gets a > copy of the content of the blkg, but the rcu mechanism doesn't prevent > destruction from going on > 2 blkg_get gets executed on the copy of the original blkg So, we can't do that. We should look up and bump the ref and use the original copy. We probably should switch blkgs to use percpu-refs. Thanks. -- tejun