From owner-freebsd-jail@FreeBSD.ORG Tue Jul 28 18:34:49 2009 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 031871065673 for ; Tue, 28 Jul 2009 18:34:49 +0000 (UTC) (envelope-from artis.caune@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id 7D95D8FC18 for ; Tue, 28 Jul 2009 18:34:48 +0000 (UTC) (envelope-from artis.caune@gmail.com) Received: by bwz12 with SMTP id 12so142777bwz.43 for ; Tue, 28 Jul 2009 11:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Bgss2Tglphpguq9HrvtycNgI6pZIGzXIu+mQujp6LcI=; b=qpTrVIeVzn/EeGmEd97V/RNeGPKrO8QJRvtM6AMv4+C0ybyK9bZfPlSeQWXggIblnW zmhXc3+Fz6vGxNPOzYeY+FbkdbBQ31GGMIv2acI7UmCBIvolUe/WQhkRRk64np8jRls8 8qM816UioE8/NUwE7dfP+koKRRu38/5RljH9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=XIvrWoAY2IAX7E3cjWWdylNXM31KOY6L7r7XhLb1p9tEicrSqZ0CxlHbrRHsDPEDSd KHGnfNlXQYq2UROjemAceJnJeLfp8izUHqF8l7oOSkYTdZSqd+7o0sWjkG7Bgvb7GM28 MZcezClzdXwi9Ghpry/IS29wjxuNxTUMVJy+U= MIME-Version: 1.0 Received: by 10.103.95.1 with SMTP id x1mr3869495mul.92.1248806087405; Tue, 28 Jul 2009 11:34:47 -0700 (PDT) In-Reply-To: <2ec071a80907280748p336f6356p78d2debcfd8cd18b@mail.gmail.com> References: <9e20d71e0907280716m3968f42pe7aeed2b0286302c@mail.gmail.com> <2ec071a80907280748p336f6356p78d2debcfd8cd18b@mail.gmail.com> Date: Tue, 28 Jul 2009 21:34:47 +0300 Message-ID: <9e20d71e0907281134j41f767ddrf3dc2e3154d724a4@mail.gmail.com> From: Artis Caune To: Alexander Petrovsky Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-jail@freebsd.org Subject: Re: Jails on ZFS 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: Tue, 28 Jul 2009 18:34:50 -0000 2009/7/28 Alexander Petrovsky : > Hi, it is may be good idea. But, I can't understand your code, why you do= - > =C2=A0umount ${_dir} >/dev/null 2>&1 || { sleep 2; umount ${_dir} >/dev/n= ull 2>&1 > || umount -f ${_dir} >/dev/null 2>&1; } > > instead > =C2=A0umount ${_dir} >/dev/null 2>&1 || umount -f ${_dir} >/dev/null 2>&1 > > ? Because when jail is shuting down, file system is still busy. I think this is because of syslogd, which has no rc.d shutdown keyword, and so it's been killed. Immediately after killing all jail processes, file systems are unmounted. It helps sleeping 1, 2 seconds and then trying to unmount it, and if fs is still busy, force unmount it. Maybe this is better: --- /etc/rc.d/jail 2009-07-22 23:29:29.000000000 +0300 +++ /etc/rc.d/jail 2009-07-28 21:23:30.436217867 +0300 @@ -270,7 +270,7 @@ _dir=3D$1 if is_current_mountpoint ${_dir}; then - umount -f ${_dir} >/dev/null 2>&1 + umount ${_dir} >/dev/null 2>&1 || umount -f ${_dir} >/dev/null 2>&1 else debug "Nothing mounted on ${_dir} - not unmounting" fi @@ -700,6 +700,7 @@ killall -j ${_jail_id} -TERM > /dev/null 2>&1 sleep 1 killall -j ${_jail_id} -KILL > /dev/null 2>&1 + sleep 2 jail_umount_fs echo -n " $_hostname" --=20 Artis Caune Everything should be made as simple as possible, but not simpler.