From tdb@paladin.sixth.bishnet.net  Wed Nov 12 23:08:51 2008
Return-Path: <tdb@paladin.sixth.bishnet.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6DA9106568E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Nov 2008 23:08:51 +0000 (UTC)
	(envelope-from tdb@paladin.sixth.bishnet.net)
Received: from carrick.bishnet.net (carrick.bishnet.net [IPv6:2a01:348:132::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 932898FC16
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Nov 2008 23:08:51 +0000 (UTC)
	(envelope-from tdb@paladin.sixth.bishnet.net)
Received: from paladin.sixth.bishnet.net ([2a01:348:131:1:20e:cff:fe7f:ced1])
	by carrick.bishnet.net with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.66 (FreeBSD))
	(envelope-from <tdb@paladin.sixth.bishnet.net>)
	id 1L0OpI-0008ff-HG
	for FreeBSD-gnats-submit@freebsd.org; Wed, 12 Nov 2008 23:08:44 +0000
Received: from tdb by paladin.sixth.bishnet.net with local (Exim 4.69 (FreeBSD))
	(envelope-from <tdb@paladin.sixth.bishnet.net>)
	id 1L0OpD-00079O-0L
	for FreeBSD-gnats-submit@freebsd.org; Wed, 12 Nov 2008 23:08:39 +0000
Message-Id: <E1L0OpD-00079O-0L@paladin.sixth.bishnet.net>
Date: Wed, 12 Nov 2008 23:08:39 +0000
From: Tim Bishop <tim@bishnet.net>
Sender: "T.D.Bishop" <tdb@paladin.sixth.bishnet.net>
Reply-To: Tim Bishop <tim@bishnet.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: System deadlock when using mksnap_ffs
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         128832
>Category:       kern
>Synopsis:       System deadlock when using mksnap_ffs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ambrisko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 12 23:10:00 UTC 2008
>Closed-Date:    Thu Nov 13 17:41:08 UTC 2008
>Last-Modified:  Fri Dec  9 17:10:07 UTC 2011
>Originator:     Tim Bishop
>Release:        FreeBSD 7.1-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD paladin 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #9: Wed Nov 12 18:47:56 GMT 2008 tdb@paladin:/usr/obj/usr/src/sys/PALADIN amd64

	Filesystem details:

	Filesystem  1K-blocks       Used     Avail Capacity  Mounted on
	/dev/da0s1a 2078881084 925352744 987217854    48%    /u2

	It's NFS exported and it's mounted from a RAID card using
	the twa driver.

>Description:
	When running mksnap_ffs on the above filesystem the system
	completely freezes up. The console is unresponsive, and
	even after a couple of hours there is still no response. I
	guess it deadlocked, but it may just be being incredibly
	slow.

	Some discussion on freebsd-stable:

	http://lists.freebsd.org/pipermail/freebsd-stable/2008-November/046524.html

>How-To-Repeat:
	paladin# cd /u2/.snap
	paladin# mksnap_ffs /u2 test.1

>Fix:
	This fix was provided to me in response to my post on
	freebsd-stable. It's against 7-STABLE. I can see what it's
	doing, but don't understand the bigger picture enough to
	know if it's sensible.

--- sys/ufs/ffs/ffs_snapshot.c.orig	2008-11-12 18:40:53.000000000 +0000
+++ sys/ufs/ffs/ffs_snapshot.c	2008-11-12 18:42:19.000000000 +0000
@@ -345,6 +345,8 @@
 		if (error)
 			goto out;
 		bawrite(nbp);
+		if (cg % 10 == 0)
+			ffs_syncvnode(vp, MNT_WAIT);
 	}
 	/*
 	 * Copy all the cylinder group maps. Although the
@@ -366,6 +368,8 @@
 			goto out;
 		error = cgaccount(cg, vp, nbp, 1);
 		bawrite(nbp);
+		if (cg % 10 == 0)
+			ffs_syncvnode(vp, MNT_WAIT);
 		if (error)
 			goto out;
 	}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ambrisko 
State-Changed-When: Thu Nov 13 17:20:43 UTC 2008 
State-Changed-Why:  
I added in the patch to 8/-current. 


Responsible-Changed-From-To: freebsd-bugs->ambrisko 
Responsible-Changed-By: ambrisko 
Responsible-Changed-When: Thu Nov 13 17:20:43 UTC 2008 
Responsible-Changed-Why:  
I added in the patch to 8/-current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128832 

From: =?windows-1251?B?yu7t/Oru4iDF4uPl7ejp?= <kes-kes@yandex.ru>
To: bug-followup@FreeBSD.org, tim@bishnet.net
Cc:  
Subject: Re: kern/128832: System deadlock when using mksnap_ffs
Date: Fri, 9 Dec 2011 19:08:13 +0200

 http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/149208
 
 more patches added
 
>Unformatted:
