From owner-freebsd-fs@FreeBSD.ORG Tue Jun 30 22:37:42 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81082106566C; Tue, 30 Jun 2009 22:37:42 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [64.81.247.49]) by mx1.freebsd.org (Postfix) with ESMTP id 5C3FE8FC1F; Tue, 30 Jun 2009 22:37:42 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (localhost [127.0.0.1]) by chez.mckusick.com (8.14.2/8.14.2) with ESMTP id n5ULwdxk002480; Tue, 30 Jun 2009 14:58:39 -0700 (PDT) (envelope-from mckusick@chez.mckusick.com) Message-Id: <200906302158.n5ULwdxk002480@chez.mckusick.com> To: Attilio Rao In-reply-to: <3bbf2fe10906300908p6b0f314di25bab46b03b5933a@mail.gmail.com> Date: Tue, 30 Jun 2009 14:58:39 -0700 From: Kirk McKusick Cc: freebsd-fs@freebsd.org, freebsd-current@freebsd.org Subject: Re: umount -f implementation X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 22:37:43 -0000 Just for the history books, there originally were two forms of forced unmounts. The gentle force (-f) and the brute force (-F) unmount. The -f unmount flushes out all the dirty buffers so that when the unmount completes no data is lost and the filesystem is in a consistent state. The -F unmount invalidates and discards all the dirty buffers without attempting to do any I/O on them. The result is lost data and a possibly inconsistent filesystem. But it will get the job done even if the disk has died or the server has gone away. For reasons that I never tracked down, the -F unmount option was never incorporated into FreeBSD when they did the merge from 4.4BSD-Lite II, so that functionality never made it into the system. It is actually much easier to do than unmount -f since you just walk through and set B_INVAL and B_ERROR on all the dirty buffers for that filesystem. The problem with unmount -f is that it will hang if the server is gone since it will insist on pushing back all the dirty buffers. Kirk McKusick