X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fsmbfs%2Fproc.c;h=418c0c36ac8b62bf677d88b526fdf074447c0638;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=8096d74922eca2757947eb961979c387c3f5ba42;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index 8096d7492..418c0c36a 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c @@ -2076,6 +2076,8 @@ out: void smb_decode_unix_basic(struct smb_fattr *fattr, char *p) { + u64 size, disk_bytes; + /* FIXME: verify nls support. all is sent as utf8? */ fattr->f_unix = 1; @@ -2093,8 +2095,19 @@ void smb_decode_unix_basic(struct smb_fattr *fattr, char *p) /* 84 L permissions */ /* 92 L link count */ - fattr->f_size = LVAL(p, 0); - fattr->f_blocks = LVAL(p, 8); + size = LVAL(p, 0); + disk_bytes = LVAL(p, 8); + + /* + * Some samba versions round up on-disk byte usage + * to 1MB boundaries, making it useless. When seeing + * that, use the size instead. + */ + if (!(disk_bytes & 0xfffff)) + disk_bytes = size+511; + + fattr->f_size = size; + fattr->f_blocks = disk_bytes >> 9; fattr->f_ctime = smb_ntutc2unixutc(LVAL(p, 16)); fattr->f_atime = smb_ntutc2unixutc(LVAL(p, 24)); fattr->f_mtime = smb_ntutc2unixutc(LVAL(p, 32));