From owner-freebsd-jail@FreeBSD.ORG Wed Aug 10 16:00:49 2011 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B654106564A for ; Wed, 10 Aug 2011 16:00:49 +0000 (UTC) (envelope-from ian@weta.stanford.edu) Received: from smtp.stanford.edu (smtp2.Stanford.EDU [171.67.219.82]) by mx1.freebsd.org (Postfix) with ESMTP id 7318B8FC08 for ; Wed, 10 Aug 2011 16:00:49 +0000 (UTC) Received: from smtp.stanford.edu (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id 074C782E8; Wed, 10 Aug 2011 09:00:49 -0700 (PDT) Received: from weta.stanford.edu (weta.Stanford.EDU [128.12.181.231]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.stanford.edu (Postfix) with ESMTPS id 36FFC81AC; Wed, 10 Aug 2011 09:00:48 -0700 (PDT) Received: from ian by weta.stanford.edu with local (Exim 4.74 (FreeBSD)) (envelope-from ) id 1QrBD6-000Jkx-3e; Wed, 10 Aug 2011 09:00:48 -0700 Date: Wed, 10 Aug 2011 09:00:48 -0700 From: Ian Downes To: joris dedieu Message-ID: <20110810160047.GA74133@weta.stanford.edu> References: <20110810021750.GA83262@weta.stanford.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: Ian Downes Cc: freebsd-jail@freebsd.org Subject: Re: umounting md backed jail filesystems - busy X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 16:00:49 -0000 Joris, thanks for the suggestions but they don't appear to indicate anything unusual. > > I'm trying to cleanup after shutting down some jails but I'm getting device > > busy errors when trying to umount some of the filesystems. > > > > More specifically, I've got an ephemeral zfs filesystem that serves as the root > > of the jail. On '/etc/rc.d/jail stop' the jail stops cleanly but when I try to > > destroy the zfs filesystem the initial umount fails, claiming it's busy. This > > happens everytime. > > > > I can't for the life of me work out who's tying it up. I've tried fstat, lsof > > and fuser but nothing is reported as active! No processes, no active files. > > What gives top -S -n 10000 |grep -i zfs while system is not > unmountable (could you see some processes in zfs state) ? > What gives jls during this time (does it report anythink still alive) ? $ jls JID IP Address Hostname Path $ top -S -n 10000 |grep -i zfs 5 root 6 -8 - 0K 88K tx->tx 2 0:01 0.00% zfskern It's entirely possible that this isn't due to a process related to the jail but it is zfs tying things up for a while. I'd like to understand what's going on though as I'd rather not just hack something together to schedule purges at some later time. > > > > Details: > > > > $ uname -a > > FreeBSD XXX.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue May 31 19:05:32 UTC 2011 ? ? root@XXX.com:/usr/obj/usr/src/sys/XENHVM ?amd64 > > > > 'data' is a md backed zpool > > > > $ mount | grep > > data/path/to/jail/root on /path/to/jail/root (zfs, local) > > > > $ fstat -f /path/to/jail/root > > USER ? ? CMD ? ? ? ? ?PID ? FD MOUNT ? ? ?INUM MODE ? ? ? ? SZ|DV R/W > > > > $ unmount /path/to/jail/root > > cannot unmount '/path/to/jail/root': Device busy > > > > Some time later, measured in minutes, something frees up and I can > > umount/destroy the filesystem ok. > > > > Can anyone offer some suggestions on what it could be or other ways to > > determine what's going on?