From owner-freebsd-fs@FreeBSD.ORG Sat Nov 10 21:00:11 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E252119 for ; Sat, 10 Nov 2012 21:00:11 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 176E98FC0C for ; Sat, 10 Nov 2012 21:00:10 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id x43so2839209wey.13 for ; Sat, 10 Nov 2012 13:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=b0SpiCs3jQYRIYjHmURzAfeJiJbH2Ul/xwleAer+Ils=; b=QWwScYE0UVWFL+WGB/dLSGPBF077V9ElfBdI9qV1g5rjkhAkJ2dsQ2m+49mg++fuPo SNvkd6xFUlyWSVjGmdlJzNUc9Qa+Aw1ZmGa6rLX2boKTXljHNmdKmcqqjNzVzw6jajTg xcT6FdXAsEFx3Gd0cdkKT9KvyMZn/yLRqbtNy71MsPM1Stts3NNfTeIBg1NK3JqMhVfj CDoWpJWvxFhigm9oq/Bw/nDiB5T/fj8m9Oq6TDiOnJiHQLRDfZAaLb0imnCDIqXtI4tj X/QCV1yf0MSfbmF4MpKCWbDI2kTDP2Fqqc00AQUjyKcCONt0E3WQOOl6Af65szAZqaet o2Gw== Received: by 10.216.212.225 with SMTP id y75mr6255153weo.39.1352581209812; Sat, 10 Nov 2012 13:00:09 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id r10sm4113610wiz.0.2012.11.10.13.00.08 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Nov 2012 13:00:09 -0800 (PST) Date: Sat, 10 Nov 2012 22:00:00 +0100 From: Mateusz Guzik To: Chris Rees Subject: Re: ZFS can't delete files when over quota Message-ID: <20121110210000.GB19081@dft-labs.eu> References: <509E79C7.10300@shatow.net> <509EA942.9060801@shatow.net> <20121110194759.GA19081@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-fs@freebsd.org, Bryan Drewery X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2012 21:00:11 -0000 On Sat, Nov 10, 2012 at 08:03:01PM +0000, Chris Rees wrote: > On 10 Nov 2012 19:48, "Mateusz Guzik" wrote: > > > > On Sat, Nov 10, 2012 at 01:21:38PM -0600, Bryan Drewery wrote: > > > On 11/10/2012 12:55 PM, Chris Rees wrote: > > > > Bryan, > > > > > > > > Please try the patch at [1]; if it works I'll document it. > > > > > > > > Chris > > > > > > > > [1] http://www.bayofrum.net/~crees/patches/bdrewery.diff > > > > > > > > > > Hmm, I'm not a fan of -T. I think it should just work out-of-the-box > here. > > > > > > Something like: > > > > > > http://people.freebsd.org/~bdrewery/rm-quota.txt > > > > > > > I think this approach is incorrect. > > > > If you cannot rm $file due to EDQUOT, but truncate $file && rm $file > > works (and both patches try to do this), then I think this is a > filesystem bug. > > Quite right, but this has been a known issue in ZFS for a while, without a > forthcoming fix. > > I'll do some grovelling in the zfs code tomorrow, wish me luck-- I don't > expect to be productive. > In this case the right fix (whatever it is) may be really non-trivial. I'm in mood for ugly hacks, so: You can think of a workardound in the kernel. If removal fails with EDQUOT and you can guarantee that no thread has this file opened and truncation will allow removal to succeed, you truncate and remove. Determining whether truncation will be able to help (and making sure that these conditions hold until removal is finised) may be non-trivial as well. But I doubt something like this could be accepted. :) My point is that even if this problem persists, changing tools in the basesystem to cope is a bad idea. If you are happy with only rm being able to cope, you can wrap/alias it on your machines. -- Mateusz Guzik