xfs
[Top] [All Lists]

Re: [PATCH] Check for immutable flag in fallocate path

To: "Ted Ts'o" <tytso@xxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Linux Kernel <linux-kernel@xxxxxxxxxxxxxxx>, cluster-devel@xxxxxxxxxx, Linux FS Devel <linux-fsdevel@xxxxxxxxxxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Subject: Re: [PATCH] Check for immutable flag in fallocate path
From: Marco Stornelli <marco.stornelli@xxxxxxxxx>
Date: Wed, 02 Mar 2011 09:19:54 +0100
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 :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=UF+itc5c2uJbluKGAG2WI9KlhUjCqytsZ6A4QGXtPLI=; b=u92ne9duuq4wp/fdv+JY6DUPkED4QXSPuJMh0r2Orts7Sw5Q57vnN8Q5NjahsOsCqB GMHKnIWOuIDuPcx79e8ZXb3Yk4rpxlALE1v28b/ASEVO236mhcmzIKsw0sv8/AmIGBKO OVOE6pcNf3haZp5OP7pKXtCipNbAFL46h72eI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=lw+w5IpPd7dLxKVy6tg4UAYRtWP8rN3c3LIp0dQ2a2rK8sVcf5umh+KXI86DLQjmoW 2zjb1901mSdI+zenaZSD/1ScTO8w5kXDXu8pUoEQ52fQN04snAW7RR8mNrtxcNNEH2EE 1tRrNPW/RxKXLhj+VCScr04GnHw0YFQdHXhwM=
In-reply-to: <20110227224940.GL2924@xxxxxxxxx>
References: <4D6221B8.9040303@xxxxxxxxx> <20110221124635.GA5525@xxxxxxxxxxxxx> <AANLkTi=bJBeR0m3xuGX_9YZPqRFuMY=bKoxZEWJt37=M@xxxxxxxxxxxxxx> <20110227224940.GL2924@xxxxxxxxx>
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
Il 27/02/2011 23:49, Ted Ts'o ha scritto:
> On Mon, Feb 21, 2011 at 05:50:21PM +0100, Marco Stornelli wrote:
>> 2011/2/21 Christoph Hellwig <hch@xxxxxxxxxxxxx>:
>>> On Mon, Feb 21, 2011 at 09:26:32AM +0100, Marco Stornelli wrote:
>>>> From: Marco Stornelli <marco.stornelli@xxxxxxxxx>
>>>>
>>>> All fs must check for the immutable flag in their fallocate callback.
>>>> It's possible to have a race condition in this scenario: an application
>>>> open a file in read/write and it does something, meanwhile root set the
>>>> immutable flag on the file, the application at that point can call
>>>> fallocate with success. Only Ocfs2 check for the immutable flag at the
>>>> moment.
>>>
>>> Please add the check in fs/open.c:do_fallocate() so that it covers all
>>> filesystems.
>>>
>>>
>>
>> The check should be done after the fs got the inode mutex lock.
> 
> Why?  None of the other places which check the IMMUTABLE flag do so

I add to my previous response an other point: IMHO each fs should check
for it because after the inclusion of punch hole patch, the fs
can/cannot check for the append-only flag. So XFS (it supports the
"unreserve") should check even for append. I think we don't want to
allow this operation for an append-only file, isn't it? About this point
I'll update and resend my patch.

Marco

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] Check for immutable flag in fallocate path, Marco Stornelli <=