From owner-freebsd-fs@FreeBSD.ORG Wed Sep 24 15:34:17 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E40D47B1 for ; Wed, 24 Sep 2014 15:34:17 +0000 (UTC) Received: from relay03.pair.com (relay03.pair.com [209.68.5.17]) by mx1.freebsd.org (Postfix) with SMTP id 990A8DFD for ; Wed, 24 Sep 2014 15:34:17 +0000 (UTC) Received: (qmail 24600 invoked from network); 24 Sep 2014 15:34:15 -0000 Received: from 87.58.146.155 (HELO x2.osted.lan) (87.58.146.155) by relay03.pair.com with SMTP; 24 Sep 2014 15:34:15 -0000 X-pair-Authenticated: 87.58.146.155 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.5/8.14.5) with ESMTP id s8OFYEUP016055; Wed, 24 Sep 2014 17:34:15 +0200 (CEST) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.5/8.14.5/Submit) id s8OFYE9e016054; Wed, 24 Sep 2014 17:34:14 +0200 (CEST) (envelope-from pho) Date: Wed, 24 Sep 2014 17:34:14 +0200 From: Peter Holm To: Bryan Drewery Subject: Re: Deadlock with umount -f involving tmpfs on top of ZFS on r271170 Message-ID: <20140924153414.GA15739@x2.osted.lan> References: <5420D5FC.4030600@FreeBSD.org> <20140923131244.GC8870@kib.kiev.ua> <5422240F.4080003@FreeBSD.org> <20140924102758.GH8870@kib.kiev.ua> <20140924132605.GA11772@x2.osted.lan> <5422E15F.8050702@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5422E15F.8050702@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD FS X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2014 15:34:18 -0000 On Wed, Sep 24, 2014 at 10:21:03AM -0500, Bryan Drewery wrote: > On 9/24/2014 8:26 AM, Peter Holm wrote: > > On Wed, Sep 24, 2014 at 01:27:58PM +0300, Konstantin Belousov wrote: > >> On Tue, Sep 23, 2014 at 08:53:19PM -0500, Bryan Drewery wrote: > >>> I tried your patch and still ran into the deadlock. Here is the debug > >>> information: https://people.freebsd.org/~bdrewery/vfs_deadlock.2.txt > >> > >> I see what is going on. Previous patch cannot help there. > >> > >> The problem is that kern_linkat() starts write with vn_start_write(9), > >> and then tries to execute namei(9) with a path potentially crossing > >> the mount point. If the mount point is being unmounted, unmount cannot > >> lay suspension on the filesystem due to writer, but it owns the covered > >> vnode lock. On the other hand, namei(9) is unable to cross the mount > >> point since covered vnode is locked, thus writer does not make progress. > >> > >> The similar issue exists in rename code. The deadlock is only possible > >> for filesystems which suspend writes on unmount; such fs are UFS and tmpfs. > >> > >> Try this. > >> > >> diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c > >> index b3b7ed5..9775480 100644 > > > > I had been trying different scenarios without much luck, but with > > your description I got the problem instantly. :) > > > > The patch is an improvement, but: > > > > http://people.freebsd.org/~pho/stress/log/kostik718.txt > > > > - Peter > > > > By the way this was my test script: > > http://dpaste.com/35AYZZ7 > > It could be simplified a lot. > Thank you. Here's what I came up with: http://people.freebsd.org/~pho/link.sh - Peter