SMB2 and allocation size
Andreas Schneider
asn at samba.org
Fri Nov 30 11:22:59 UTC 2018
Hi,
my gitlab runner for MIT KRB5 failed when running the samba3.smb2.session test
with the following error:
Exception: Exception: ../../source4/torture/smb2/session.c:85: (&io1)-
>out.alloc_size was 1048576 (0x100000), expected 0 (0x0): out.alloc_size
incorrect
I've tracked it down to a difference in vfswrap_get_alloc_size().
On the docker image an empty file gets 8 blocks:
$ touch foo && stat foo
File: foo
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 809h/2057d Inode: 1593246 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-11-30 11:12:16.000000000 +0000
Modify: 2018-11-30 11:12:16.000000000 +0000
Change: 2018-11-30 11:12:16.000000000 +0000
Birth: -
Then this is rounded up by smb_roundup() at the end of
vfswrap_get_alloc_size().
On my system locally with btrfs this is:
$ touch foo && stat foo
File: foo
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd02h/64770d Inode: 135018551 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ asn) Gid: ( 1000/ asn)
Access: 2018-11-30 12:19:25.891655519 +0100
Modify: 2018-11-30 12:19:25.891655519 +0100
Change: 2018-11-30 12:19:25.891655519 +0100
Birth: -
As vfswrap_get_alloc_size() states to handle sparse files, I think this is the
reason for the roundup. Attached is a patch to address this in the torture
test. I'm not sure if this should be addressed differently.
Please check the attached file and review it.
Thanks,
Andreas
--
Andreas Schneider asn at samba.org
Samba Team www.samba.org
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s4-torture-Check-if-the-size-is-the-SMB-roundup-size.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181130/0a463693/0001-s4-torture-Check-if-the-size-is-the-SMB-roundup-size.bin>
More information about the samba-technical
mailing list