X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham version=3.4.0-r929098 Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p24CKwO3162348 for ; Fri, 4 Mar 2011 06:20:58 -0600 X-ASG-Debug-ID: 1299241428-77a700a70000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from mail-ww0-f51.google.com (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id B1D813130F4 for ; Fri, 4 Mar 2011 04:23:48 -0800 (PST) Received: from mail-ww0-f51.google.com (mail-ww0-f51.google.com [74.125.82.51]) by cuda.sgi.com with ESMTP id 0f7S6Afb6JK40RMT for ; Fri, 04 Mar 2011 04:23:48 -0800 (PST) Received: by wwf26 with SMTP id 26so1972276wwf.32 for ; Fri, 04 Mar 2011 04:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=vUUzf4mvBbYqgISE7V++MBQQyQ007jqPMvh41Td9g6o=; b=J0NZI1w5xJ0LwtsgiBaoaUXhCBPZLlTQXIOeHx3K9rLn63Q0gKwWvilc5sa/tioFLb R4tqlrFAY1RGUlaZHYuWwFY8lNNC1UxbeD7Bd0UiFSTlLj3oHPSur3YuZH21ucAM2foO NCaOWAIXGTCkZexMKCrGrxeB5R1MV04Up9JXw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=NTnk8yIoZ4PK4posSDhQHfzygpbs+uuiATGHPyRo1pVuTqJWwdfGqlohFyQsMXnl10 JpiIB3WcKGh+mHGoc6U0mxPSoCtjPpQVswRYIaieQCh7gNWaUUmzeXlF7u4AkJ/rNUw+ TVEFxf+xnZfSxHxVCqLvxubX0MWRDweO6aDoQ= Received: by 10.216.171.133 with SMTP id r5mr474730wel.91.1299241428026; Fri, 04 Mar 2011 04:23:48 -0800 (PST) Received: from [82.59.179.64] (host64-179-dynamic.59-82-r.retail.telecomitalia.it [82.59.179.64]) by mx.google.com with ESMTPS id u2sm1135348weh.36.2011.03.04.04.23.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 04:23:46 -0800 (PST) Message-ID: <4D70D89C.6090307@gmail.com> Date: Fri, 04 Mar 2011 13:18:36 +0100 From: Marco Stornelli User-Agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: Dave Chinner CC: Linux Kernel , linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, cluster-devel@redhat.com, xfs@oss.sgi.com, Linux FS Devel , tytso@mit.edu X-ASG-Orig-Subj: Re: [PATCH v2] Check for immutable flag in fallocate path Subject: Re: [PATCH v2] Check for immutable flag in fallocate path References: <4D6221B8.9040303@gmail.com> <4D6F5473.2070709@gmail.com> <20110303213903.GL15097@dastard> <4D709FFC.6000107@gmail.com> In-Reply-To: <4D709FFC.6000107@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Barracuda-Connect: mail-ww0-f51.google.com[74.125.82.51] X-Barracuda-Start-Time: 1299241429 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests=DKIM_SIGNED, DKIM_VERIFIED X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.57023 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- -0.00 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean Il 04/03/2011 09:17, Marco Stornelli ha scritto: > Hi Dave, > > Il 03/03/2011 22:39, Dave Chinner ha scritto: >> WTF? Why does append mode have any effect on whether we can punch >> holes in a file or not? There's no justification for adding this in >> the commit message. Why is it even in a patch that is for checking >> immutable inodes? What is the point of adding it, when all that will >> happen is people will switch to XFS_IOC_UNRESVSP which has never had >> this limitation? > > So according to you, it's legal to do an "unreserve" operation on an > append-only file. It's not the same for me, but if the community said > that this is the right behavior then ok. > >> >> And this asks bigger questions - why would you allow preallocate >> anywhere but at or beyond EOF on an append mode inode? You can only >> append to the file, so if you're going to add limitations based on >> the append flag, you need to think this through a bit more.... >> > > I don't understand this point. The theory of operation was: > > 1) we don't allow any operation (reserve/unreserve) on a immutable file; > 2) we don't allow *unreserve* operation on an append-only file (this > check makes sense only for fs that support the unreserve operation). > >> >> Also, like Christoph said, these checks belong in the generic code, >> not in every filesystem. The same checks have to be made for every >> filesystem, so they should be done before calling out the >> filesystems regardless of what functionality the filesystem actually >> supports. >> > > This was related to the first point, if we remove it then it's ok to > check in a common code. Even if I think we should do the check under the > inode lock to avoid race between fallocate and setattr, isn't it? > Oops, I meant setflags in ioctl path, sorry. At this point I'm waiting for response about how to manage the append flag and how to manage the lock on the flags. Ted pointed out that a proper fix would be to avoid the lock and use bit operation but it requires a deep modification on several fs and it could be a separate patch and code review, so I think we can choice to use lock/unlock in do_fallocate. I'll resend the patch. Marco