mount_smbfs(8) && problem with write(2) / fstat(2)

Matthias Apitz guru at unixarea.de
Thu Mar 30 10:42:35 UTC 2017


Hello,

I run a 12-CURRENT r314251 amd64 in vbox and encounter the following
problem: a written file to a filesystem which is mounted with
mount_smbfs(8) from the host system (Win7) returns size=0 in fstat(2)
syscall right after writing:

# gzip uu
gzip: output file: uu.gz wrong size (0 != 56111), deleting
gzip: leaving original uu

# truss gzip uu
...
openat(AT_FDCWD,"uu",O_RDONLY,00)		 = 3 (0x3)
fstat(3,{ mode=-rwxr-xr-x ,inode=696197458,size=120561,blksize=4356 }) = 0 (0x0)
stat("uu.gz",0x7fffffffda80)			 ERR#2 'No such file or directory'
openat(AT_FDCWD,"uu.gz",O_WRONLY|O_CREAT|O_EXCL,0600) = 4 (0x4)
read(3,"MD5 (a2ps-4.13b_8.txz) = 7384bda"...,65536) = 65536 (0x10000)
read(3," 7e53b2679549ca00fcbb255ab5ac8e4"...,65536) = 55025 (0xd6f1)
read(3,0x80182d980,65536)			 = 0 (0x0)
write(4,"\^_\M^K\b\b:\M-Q\M-\X\0\^Cuu\0"...,56103) = 56103 (0xdb27)
write(4,"ZR5\f\M-q\M-V\^A\0",8)			 = 8 (0x8)

56103+8 = 56111 have been written fine, but the following fstat(2) gives
size=0:

close(3)					 = 0 (0x0)
fstat(4,{ mode=-rwxr-xr-x ,inode=2623741163,size=0,blksize=4356 }) = 0 (0x0)
gzip: write(2,"gzip: ",6)				 = 6 (0x6)
output file: uu.gz wrong size (0 != 56111), deletingwrite(2,"output file: uu.gz wrong size (0"...,52) = 52 (0x34)

write(2,"\n",1)					 = 1 (0x1)
close(4)					 = 0 (0x0)
gzip: write(2,"gzip: ",6)				 = 6 (0x6)
leaving original uuwrite(2,"leaving original uu",19)		 = 19 (0x13)

write(2,"\n",1)					 = 1 (0x1)
unlink("uu.gz")					 = 0 (0x0)
exit(0x1)					
process exit, rval = 1

One can write the file this way fine:

# gzip -c uu > uu.gz
# ls -l
total 173
-rwxr-xr-x  1 guru  wheel  120561 30 mar.  11:34 uu
-rwxr-xr-x  1 guru  wheel   56111 30 mar.  11:46 uu.gz

What does this mean?

	matthias

-- 
Matthias Apitz, ✉ guru at unixarea.de, ⌂ http://www.unixarea.de/  ☎ +49-176-38902045


More information about the freebsd-questions mailing list