Messages in this thread Patch in this message | | | Date | Thu, 5 Apr 2001 01:00:15 +0200 (CEST) | From | Urban Widmark <> | Subject | Re: [BUG] smbfs: caching problems |
| |
On Sun, 1 Apr 2001, Xuan Baldauf wrote:
> there is something wrong with smbfs caching which makes my > applications fail. The behaviour happens with > linux-2.4.3-pre4 and linux-2.4.3-final. > > Consider following shell script: (where /mnt/n is a > smbmounted smb share from a Win98SE box)
Try the attached patch, as a workaround.
Not really sure what is happening, but it seems like win98se isn't updating the filesize immediately (?).
After truncating the file to 0 bytes the server still returns the old size (516) when asked (smb_proc_getattr). Somewhere that causes something to keep the pages for the file (smb_revalidate?) or simply be confused on the length of the file (508).
I don't understand how as vmtruncate should have thrown out the old stuff already ... maybe the same page is reused and the last bytes (that shouldn't be in the file) remain from the last write.
It works with NT4 and Samba, they both return the expected 0 bytes after truncating to 0. refresh = 0 will not ask and instead run with the 0 byte length that vmtruncate has set.
/Urban diff -urN -X exclude linux-2.4.3-orig/fs/smbfs/inode.c linux-2.4.3-smbfs/fs/smbfs/inode.c --- linux-2.4.3-orig/fs/smbfs/inode.c Sat Mar 31 19:11:53 2001 +++ linux-2.4.3-smbfs/fs/smbfs/inode.c Thu Apr 5 00:32:07 2001 @@ -234,9 +234,10 @@ last_sz = inode->i_size; error = smb_refresh_inode(dentry); if (error || inode->i_mtime != last_time || inode->i_size != last_sz) { - VERBOSE("%s/%s changed, old=%ld, new=%ld\n", + VERBOSE("%s/%s changed, old=%ld, new=%ld, osz=%ld, sz=%ld\n", DENTRY_PATH(dentry), - (long) last_time, (long) inode->i_mtime); + (long) last_time, (long) inode->i_mtime, + (long) last_sz, (long) inode->i_size); if (!S_ISDIR(inode->i_mode)) invalidate_inode_pages(inode); @@ -550,7 +551,7 @@ if (error) goto out; vmtruncate(inode, attr->ia_size); - refresh = 1; + refresh = 0; } /* | |