Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbdITRf7 (ORCPT ); Wed, 20 Sep 2017 13:35:59 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:46035 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbdITRf4 (ORCPT ); Wed, 20 Sep 2017 13:35:56 -0400 Date: Wed, 20 Sep 2017 10:35:52 -0700 From: Christoph Hellwig To: Waiman Long 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 , Christoph Hellwig Subject: Re: [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops Message-ID: <20170920173552.GA14611@infradead.org> References: <1505928371-27829-1-git-send-email-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1505928371-27829-1-git-send-email-longman@redhat.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 889 Lines: 17 > +/* > + * When reading or writing the blktrace sysfs files, the references to the > + * opened sysfs or device files should prevent the underlying block device > + * from being removed. So no further delete protection is really needed. > + * > + * Protection from multiple readers and writers accessing blktrace data > + * concurrently is still required. The bd_mutex was used for this purpose. > + * That could lead to deadlock with concurrent block device deletion and > + * sysfs access. As a result, a new blk_trace_mutex is now added to be > + * used solely by the blktrace code. > + */ Comments about previous locking schemes really don't have a business in the code - those are remarks for the commit logs. And in general please explain the locking scheme near the data that they proctect it, as locks should always protected data, not code and the comments should follow that.