Skip to contentSkip to conversation

Bug in ext4/btrfs fallocate?

DISCUSSION Marco Stornelli 2 participants 3 messages Dec 28, 2010 – Dec 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

it seems that ext4/btrfs code for fallocate doesn't check for immutable/append inode flag. I think it's possible to do an fallocate operation even if the immutable flag is turned on. You can think about this case: an application opens a file for read/write, meanwhile a user set the immutable flag and then the application calls fallocate. Other cases shouldn't happen because if the immutable flag is turned on before the application opens the file, then the application can't open the file in read/write mode and therefore it can't do an fallocate operation. Sincerely I haven't tried but I saw this kind of error in my own fs that have a similar code.

Regards,

Marco

#1 lore raw
Quoted 2 lines · Marco Stornelli

it seems that ext4/btrfs code for fallocate doesn't check for immutable/append inode flag.

fallocate() probably shouldn't be allowed for immutable files, but it makes a lot of sense to call fallocate() on append-only files to avoid fragmentation, though it should only be called with the KEEP_SIZE flag.

Cheers, Andreas

#2 lore raw

Il 29/12/2010 07:46, Andreas Dilger ha scritto:

Quoted 8 lines · Marco Stornelli
Quoted 2 lines

it seems that ext4/btrfs code for fallocate doesn't check for immutable/append inode flag.

fallocate() probably shouldn't be allowed for immutable files, but it makes a lot of sense to call fallocate() on append-only files to avoid fragmentation, though it should only be called with the KEEP_SIZE flag.

Cheers, Andreas

It seems that only ocfs2 does that check, however I think not checking for immutable flag is an error, for the append case maybe you're right, doing this operation on append-only files has got sense.

Marco