From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757951AbYERPLT (ORCPT ); Sun, 18 May 2008 11:11:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753869AbYERPLD (ORCPT ); Sun, 18 May 2008 11:11:03 -0400 Received: from hu-out-0506.google.com ([72.14.214.224]:15003 "EHLO hu-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbYERPLA (ORCPT ); Sun, 18 May 2008 11:11:00 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=AdpghFYv1VqK3tG6XLg5Gs4jy756QzIMXnRAcRa/eEExfgRCsplQi8A1DU06wjOjzB1/Zalxo47NA0Iu1xc/ucgRwMBirXfkoDuDbLcCn1aJTEyBpqWzdLSqiLEuaMVLRh33ulxnrlALddLxqbTgn5wswxeqf+N3ndyaOfsYgBQ= Date: Sun, 18 May 2008 19:10:48 +0400 From: Cyrill Gorcunov To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Michael Halcrow , Eric Sandeen , Peter Zijlstra Subject: Re: [v2.6.26-rc1] possible circular locking in ecryptfs Message-ID: <20080518151048.GB18000@cvg> References: <20080507200228.GA17810@elte.hu> <20080509094422.GA19090@elte.hu> <20080510084759.GB6872@cvg> <20080518114020.GA14889@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080518114020.GA14889@elte.hu> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Ingo Molnar - Sun, May 18, 2008 at 01:40:20PM +0200] | | * Cyrill Gorcunov wrote: | | > [Ingo Molnar - Fri, May 09, 2008 at 11:44:23AM +0200] | > | | > | * Ingo Molnar wrote: | > | | > | > x86.git testing found the following "possible circular locking" | > | > lockdep warning, generated by the ecryptfs code: | > | | > | the correct URL for the config is: | > | | > | http://redhat.com/~mingo/misc/config-Wed_May__7_16_17_31_CEST_2008.bad | > | | > | this is reproducible, it happened a second time since i originally | > | reported it. | > | | > | Ingo | > | > Hi Ingo, I've just sent patch, could you test it, please? | > | > http://lkml.org/lkml/2008/5/10/20 | | that patch is now upstream - but see below there's still a circular | dependency. | | Ingo | | Ingo, could you test this patch please? If it help I will send it in normal way. - Cyrill - --- Index: linux-2.6.git/fs/ecryptfs/miscdev.c =================================================================== --- linux-2.6.git.orig/fs/ecryptfs/miscdev.c 2008-05-18 18:53:56.000000000 +0400 +++ linux-2.6.git/fs/ecryptfs/miscdev.c 2008-05-18 19:08:25.000000000 +0400 @@ -50,7 +50,6 @@ ecryptfs_miscdev_poll(struct file *file, current->nsproxy->user_ns); BUG_ON(rc || !daemon); mutex_lock(&daemon->mux); - mutex_unlock(&ecryptfs_daemon_hash_mux); if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { printk(KERN_WARNING "%s: Attempt to poll on zombified " "daemon\n", __func__); @@ -62,6 +61,7 @@ ecryptfs_miscdev_poll(struct file *file, goto out_unlock_daemon; daemon->flags |= ECRYPTFS_DAEMON_IN_POLL; mutex_unlock(&daemon->mux); + mutex_unlock(&ecryptfs_daemon_hash_mux); poll_wait(file, &daemon->wait, pt); mutex_lock(&daemon->mux); if (!list_empty(&daemon->msg_ctx_out_queue)) @@ -69,6 +69,8 @@ ecryptfs_miscdev_poll(struct file *file, out_unlock_daemon: daemon->flags &= ~ECRYPTFS_DAEMON_IN_POLL; mutex_unlock(&daemon->mux); + if (mutex_is_locked(&ecryptfs_daemon_hash_mux)) + mutex_unlock(&ecryptfs_daemon_hash_mux); return mask; } @@ -257,14 +259,12 @@ ecryptfs_miscdev_read(struct file *file, mutex_lock(&daemon->mux); if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { rc = 0; - mutex_unlock(&ecryptfs_daemon_hash_mux); printk(KERN_WARNING "%s: Attempt to read from zombified " "daemon\n", __func__); goto out_unlock_daemon; } if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) { rc = 0; - mutex_unlock(&ecryptfs_daemon_hash_mux); goto out_unlock_daemon; } /* This daemon will not go away so long as this flag is set */ @@ -357,6 +357,8 @@ out_unlock_msg_ctx: out_unlock_daemon: daemon->flags &= ~ECRYPTFS_DAEMON_IN_READ; mutex_unlock(&daemon->mux); + if (mutex_is_locked(&ecryptfs_daemon_hash_mux)) + mutex_unlock(&ecryptfs_daemon_hash_mux); return rc; }