From: Andrew Morton Subject: Re: [Bug 2829] New: posix_locks_deadlock() loops infinitely Date: Thu, 3 Jun 2004 22:53:25 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040603225325.52465d89.akpm@osdl.org> References: <20040603225012.301f42a6.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from fw.osdl.org ([65.172.181.6]:58811 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S265628AbUFDFyJ (ORCPT ); Fri, 4 Jun 2004 01:54:09 -0400 To: i-sakamoto@pb.jp.nec.com In-Reply-To: <20040603225012.301f42a6.akpm@osdl.org> List-Id: linux-fsdevel.vger.kernel.org Andrew Morton wrote: > > > > Begin forwarded message: > > Date: Thu, 3 Jun 2004 22:45:56 -0700 > From: bugme-daemon@osdl.org > To: bugme-new@lists.osdl.org > Subject: Spam: [Bugme-new] [Bug 2829] New: posix_locks_deadlock() loops infinitely > Do you have a test app which demonstrates the bug? > http://bugme.osdl.org/show_bug.cgi?id=2829 > > Summary: posix_locks_deadlock() loops infinitely > Kernel Version: 2.6.6 > Status: NEW > Severity: normal > Owner: fs_vfs@kernel-bugs.osdl.org > Submitter: i-sakamoto@pb.jp.nec.com > > > Distribution: debian > Hardware Environment: > Software Environment: > Problem Description: Using POSIX threads makes posix_locks_deadlock() loop > infinitely. > > Steps to reproduce: > > There are 3 processes; "A", "B" and "C". > Each process opens "file1", "file2" and "file3". > > "A" creates 3 POSIX threads; "A1", "A2" and "A3". (These threads' PIDs are the > same.) > "B" creates 2 POSIX threads; "B1" and "B2". (These threads' PIDs are the same.) > "C" creates 1 POSIX thread; "C1". > > > 1. "A1" locks "file1" exclusively. > 2. "B1" locks "file2" exclusively. > 3. "C1" locks "file3" exclusively. > 4. "A2" trys to lock "file2" and sleeps (blocked by "B1"). > 5. "A3" trys to lock "file3" and sleeps (blocked by "C1"). > 6. "B2" trys to lock "file1". > Here, posix_locks_deadlock() must detect deadlock, but > it does not. Then "B2" sleeps (blocked "A1"). > > "A" "B" > | | > +--A1(LOCK)---->(file1)<-B2(*deadlock)-+ > | | > | | > +--A2(BLOCK)--->(file2)<---B1(LOCK)----+ > | > | > +--A3(BLOCK)--->(file3)<---C1(LOCK)----"C" > > block_list -> A3(BLOCK) -> A2(BLOCK) > > > 7. "C1" unlocks "file3". ("A3" wakes up and locks "file3".) > 8. "A3" unlocks "file3". > 9. Another process locks "file1". > This makes posix_locks_deadlock() loop infinitely. > > ------- You are receiving this mail because: ------- > You are on the CC list for the bug, or are watching someone who is.