From patchwork Thu Sep 12 03:16:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 2875511 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A4BAEBF43F for ; Thu, 12 Sep 2013 03:16:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E2CF201EF for ; Thu, 12 Sep 2013 03:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA9062013A for ; Thu, 12 Sep 2013 03:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577Ab3ILDQK (ORCPT ); Wed, 11 Sep 2013 23:16:10 -0400 Received: from fieldses.org ([174.143.236.118]:38787 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502Ab3ILDQJ (ORCPT ); Wed, 11 Sep 2013 23:16:09 -0400 Received: from bfields by fieldses.org with local (Exim 4.76) (envelope-from ) id 1VJxO4-00019W-EW; Wed, 11 Sep 2013 23:16:08 -0400 Date: Wed, 11 Sep 2013 23:16:08 -0400 From: "J. Bruce Fields" To: "J. Bruce Fields" Cc: Al Viro , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, jlayton@redhat.com, Dave Chinner Subject: [PATCH 02/13--revised] vfs: don't use PARENT/CHILD lock classes for non-directories Message-ID: <20130912031608.GD1462@fieldses.org> References: <1378929799-1110-1-git-send-email-bfields@redhat.com> <1378929799-1110-3-git-send-email-bfields@redhat.com> <20130912031430.GC1462@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130912031430.GC1462@fieldses.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "J. Bruce Fields" Reserve I_MUTEX_PARENT and I_MUTEX_CHILD for locking of actual directories. (Also I_MUTEX_QUOTA isn't really a meaningful name for this locking class any more; fixed in a later patch.) Acked-by: Jeff Layton Signed-off-by: J. Bruce Fields --- fs/inode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) > Argh, apologies! Revising this patch at one point I forgot to fix up > one line, and I somehow overlooked the resulting lockdep warning till > just now. So the revised patch looks like this. diff --git a/fs/inode.c b/fs/inode.c index 20750b0..a8a8ded 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -990,16 +990,16 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2) { WARN_ON_ONCE(S_ISDIR(inode1->i_mode)); if (inode1 == inode2 || !inode2) { - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); + mutex_lock(&inode1->i_mutex); return; } WARN_ON_ONCE(S_ISDIR(inode2->i_mode)); if (inode1 < inode2) { - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); - mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); + mutex_lock(&inode1->i_mutex); + mutex_lock_nested(&inode2->i_mutex, I_MUTEX_QUOTA); } else { - mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT); - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD); + mutex_lock(&inode2->i_mutex); + mutex_lock_nested(&inode1->i_mutex, I_MUTEX_QUOTA); } } EXPORT_SYMBOL(lock_two_nondirectories);