From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbdISMtT (ORCPT ); Tue, 19 Sep 2017 08:49:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbdISMtR (ORCPT ); Tue, 19 Sep 2017 08:49:17 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE1A61F574 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=longman@redhat.com Subject: Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops To: Christoph Hellwig Cc: Jens Axboe , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-nilfs@vger.kernel.org, cluster-devel@redhat.com, Bart Van Assche References: <1505760831-7747-1-git-send-email-longman@redhat.com> <1505760831-7747-2-git-send-email-longman@redhat.com> <20170919000155.GA30806@infradead.org> From: Waiman Long Organization: Red Hat Message-ID: Date: Tue, 19 Sep 2017 08:49:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170919000155.GA30806@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 19 Sep 2017 12:49:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/18/2017 08:01 PM, Christoph Hellwig wrote: > Taking a look at this it seems like using a lock in struct block_device > isn't the right thing to do anyway - all the action is on fields in > struct blk_trace, so having a lock inside that would make a lot more > sense. > > It would also help to document what exactly we're actually protecting. I think I documented in the patch that the lock has to protect changes in the blktrace structure as well as the allocation and destruction of it. Because of that, it can't be put inside the blktrace structure. The original code use the bd_mutex of the block_device structure. I just change the code to use another bd_fsfreeze_mutex in the same structure. In an earlier patch version, I used a global blktrace mutex. This was deemed to be not scalable enough and so I now use the bd_fsfreeze_mutex instead. Cheers, Longman