mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
vfs_gpfs: Block punchhole calls for non-sparse files
The core smbd code implements ZERO_DATA for non-sparse files by punching a hole and filling it again with a fallocate(FL_KEEP_SIZE) call. As GPFS does not provide the fallocate(FL_KEEP_SIZE) call and non-sparse files should not contain holes, block the punchhole; effectively only allowing ZERO_DATA/punchhole calls for sparse files. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Apr 23 00:33:03 UTC 2019 on sn-devel-144
This commit is contained in:
parent
a0bc1f9d43
commit
1c3731ccef
@ -1946,6 +1946,21 @@ static int vfs_gpfs_fallocate(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp, uint32_t mode,
|
||||
off_t offset, off_t len)
|
||||
{
|
||||
if (mode == (VFS_FALLOCATE_FL_PUNCH_HOLE|VFS_FALLOCATE_FL_KEEP_SIZE) &&
|
||||
!fsp->is_sparse &&
|
||||
lp_strict_allocate(SNUM(fsp->conn))) {
|
||||
/*
|
||||
* This is from a ZERO_DATA request on a non-sparse
|
||||
* file. GPFS does not support FL_KEEP_SIZE and thus
|
||||
* cannot fill the whole again in the subsequent
|
||||
* fallocate(FL_KEEP_SIZE). Deny this FL_PUNCH_HOLE
|
||||
* call to not end up with a hole in a non-sparse
|
||||
* file.
|
||||
*/
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user