From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Allison Subject: Re: posix_lock_deadlocks() hang Date: Tue, 14 Sep 2004 12:28:14 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040914192814.GE16151@jeremy1> References: <7A8F92187EF7A249BF847F1BF4903C040AFBF3@ausx2kmpc103.aus.amer.dell.com> Reply-To: Jeremy Allison Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jra@samba.org, michael@wil.cx, linux-fsdevel@vger.kernel.org Return-path: Received: from dp.samba.org ([66.70.73.150]:31696 "EHLO lists.samba.org") by vger.kernel.org with ESMTP id S269367AbUINT2R (ORCPT ); Tue, 14 Sep 2004 15:28:17 -0400 To: Stuart_Hayes@Dell.com Content-Disposition: inline In-Reply-To: <7A8F92187EF7A249BF847F1BF4903C040AFBF3@ausx2kmpc103.aus.amer.dell.com> List-Id: linux-fsdevel.vger.kernel.org On Tue, Sep 14, 2004 at 02:23:29PM -0500, Stuart_Hayes@Dell.com wrote: > Jeremy Allison wrote: > > On Mon, Sep 13, 2004 at 03:25:41PM -0500, Stuart_Hayes@Dell.com wrote: > >> > >> I am seeing the kernel get stuck in an endless loop in > >> posix_locks_deadlock() checking for deadlocks. > >> > >> It appears that samba (smbd) is getting both flocks and posix locks. > >> Since flock_lock_file() isn't checking for potential deadlocks before > >> adding lock requests to the blocked_list, we end up with (what > >> appears to be) a circular dependency between a posix lock and an > >> flock in blocked_list. > > > > I'm not aware that we obtain any locks with flock. We only use fcntl > > (POSIX) locks. I just grepped the code so I'm quite sure :-). > > > > Jeremy. > > I haven't specifically traced your application, but, while debugging the > locking code, I definitely saw smbd requesting both flocks and posix > locks. > > Also, looking at Samba version 3.0.6, from Red Hat Enterprise Linux, and > I see > source/smbd/open.c: if (kernel_mode) flock(fsp->fd, kernel_mode); > among other grep matches. > > I just checked 3.0.7, and it seems to do the same thing. Yes, that's only if #if HAVE_KERNEL_SHARE_MODES is defined, which is not turned on by default. That's only done if someone sets it by hand (it's not autoconf tested). It's also not a standard flock (to lock files) but a request for a share mode in the kernel. Did you turn this on ? Jeremy.