From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbdBUUvA (ORCPT ); Tue, 21 Feb 2017 15:51:00 -0500 Received: from mail-yb0-f196.google.com ([209.85.213.196]:34406 "EHLO mail-yb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbdBUUuy (ORCPT ); Tue, 21 Feb 2017 15:50:54 -0500 Date: Tue, 21 Feb 2017 15:50:51 -0500 From: Tejun Heo To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Tony Lindgren Subject: Re: [PATCH] kernfs: fix locking around kernfs_ops->release() callback Message-ID: <20170221205051.GC8260@htj.duckdns.org> References: <20170209003642.GY3897@atomide.com> <20170211031819.GC19050@mtj.duckdns.org> <20170211044855.GC3897@atomide.com> <20170211203302.GA25834@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170211203302.GA25834@mtj.duckdns.org> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 12, 2017 at 05:33:02AM +0900, Tejun Heo wrote: > The release callback may be called from two places - file release > operation and kernfs open file draining. kernfs_open_file->mutex is > used to synchronize the two callsites. This unfortunately leads to > possible circular locking because of->mutex is used to protect the > usual kernfs operations which may use locking constructs which are > held while removing and thus draining kernfs files. > > @of->mutex is for synchronizing concurrent kernfs access operations > and all we need here is synchronization between the releaes and drain > paths. As the drain path has to grab kernfs_open_file_mutex anyway, > let's use the mutex to synchronize the release operation instead. > > Signed-off-by: Tejun Heo > Reported-by: Tony Lindgren > Fixes: 0e67db2f9fe9 ("kernfs: add kernfs_ops->open/release() callbacks") Applied to cgroup/for-4.11. Thanks. -- tejun