From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941164AbcHJTGv (ORCPT ); Wed, 10 Aug 2016 15:06:51 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:36202 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934217AbcHJTG2 (ORCPT ); Wed, 10 Aug 2016 15:06:28 -0400 Date: Wed, 10 Aug 2016 15:06:26 -0400 From: Tejun Heo To: axboe@kernel.dk, akinobu.mita@gmail.com, tom.leiming@gmail.com Cc: kent.overstreet@gmail.com, cl@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCHSET percpu/for-4.4] percpu_ref: make mode switching operations synchronize themselves Message-ID: <20160810190626.GO25053@mtj.duckdns.org> References: <1443563240-29306-1-git-send-email-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443563240-29306-1-git-send-email-tj@kernel.org> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2015 at 05:47:15PM -0400, Tejun Heo wrote: > Hello, > > Mostly for historical reasons, percpu_ref atomic/percpu mode switching > operations require the users to synchronize different operations > although there are valid usage scenarios where different types of > operations racing against each other makes sense. This unusual > requirement led to a subtle race condition in blk-mq which was spotted > by Akinobu Mita[1]. > > Akinobu proposed a blk-mq specific fix where it adds an enclosing > mutex around the percpu_ref operations; however, this is a percpu_ref > deficiency and fixing it at the source is the better long term > approach. Unfortunately, this ended up being a somewhat invasive set > of changes and the right thing to do likely is applying Akinobu's fix > for 4.3 / -stable, applying this patchset for 4.4 window and reverting > Akinobu's patch after the 4.4 merge window. > > Akinobu, can you please verify that this patchset makes the race > condition go away? Okay, this patchset got forgotten while waiting response from Akinobu. I'm applying the patchset to percpu/for-4.9 as the changes are general improvements to percpu_refcnt. Thanks. -- tejun