fallocate behavior during ENOSPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Does anyone know how fallocate should behave if it hits an ENOSPC in the middle
of the block reservation? The man page is not really specific about it.

Being more specific:

If we try to fallocate a 10G file, but the filesystem does not have enough space
to accommodate the whole allocation request, it will return an ENOSPC, but, it
doesn't specifically says if the whole allocation should fail or if we can end
up with a partially allocation.

In the man page:

"After a successful call, subsequent writes into the range specified by offset
and len are guaranteed not to fail because of lack of disk space."

and:

"ENOSPC There  is  not enough space left on the device containing the file
referred to by fd."

By my interpretation, I'd say that if the fallocate fails with -ENOSPC, no
allocation should be done at all, and the file size should not be changed,
once we can't guarantee the writes will not fail due lack of disk space.

However, what I see is a different behavior for different filesystems, for
instance, if the file already has some blocks allocated, Ext4 will leave the
file with a partial pre-allocation made by fallocate, while XFS does not change
file size of add any extra blocks to the file at all.

If the original file size is 0, it changes a bit, Ext4 will still change the
file size and leave the partially allocated blocks there, while XFS won't change
the file size, but will keep the partially pre-allocated blocks.

I wonder how it should really behave or if it is a filesystem decision?

Cheers



-- 
Carlos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux