Bug 208775 - CIFS: fallocate can't change file system disk space usage
Summary: CIFS: fallocate can't change file system disk space usage
Status: RESOLVED WILL_NOT_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: CIFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_cifs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-03 02:13 UTC by Xiaoli Feng
Modified: 2021-08-30 03:00 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.8.0-rc7+
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Xiaoli Feng 2020-08-03 02:13:54 UTC
Samba server and client are on the same host. Mount the samba share with the option "-o user=root,password=$testPasswd,cache=none". Use "df -h" to check the space usage. Then use fallocate to preallocate 1G file. Finally use df to check again the space usage. But it doesn't change. Test xfs filesystem. fallocate can change the space usage.

# cat /etc/samba/smb.conf
[cifs]
path=/mnt/cifs
writeable=yes
# mount //localhost/cifs cifs -o user=root,password=redhat,cache=none,actimeo=0
# df -h cifs
Filesystem        Size  Used Avail Use% Mounted on
//localhost/cifs   36G   23G   13G  66% /root/cifs
#  fallocate -o 0 -l 2g /root/cifs/file1
# df -h cifs
Filesystem        Size  Used Avail Use% Mounted on
//localhost/cifs   36G   23G   13G  66% /root/cifs

Test xfs filesystem.
# mount -o loop /home/xfs.img  xfs
# df -h xfs
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0     1014M   40M  975M   4% /root/xfs
# fallocate -o 0 -l 200M xfs/file
# df -h xfs
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0     1014M  240M  775M  24% /root/xfs
Comment 1 Steve French 2020-08-03 22:27:22 UTC
There is a probably Samba server bug here - since it didn't mark the file as a sparse file (so we in the client can't know to unsparse it to fix this) but ... the easiest way to fix this is to use a recommended Samba server config setting for xfs/btrfs/ext4 which is "strict allocate = yes" in the server's smb.conf file.

When I tried with that update to smb.conf - seems to work fine.
Comment 2 Xiaoli Feng 2021-08-30 03:00:42 UTC
close it by comment 1.

Note You need to log in before you can comment on or make changes to this bug.