mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Urban Widmark <urban@teststation.com>
To: Xuan Baldauf <xuan--lkml@baldauf.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] smbfs: caching problems
Date: Thu, 5 Apr 2001 01:00:15 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.30.0104050032430.16277-200000@cola.teststation.com> (raw)
In-Reply-To: <3AC68228.E9D8161B@baldauf.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1074 bytes --]

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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 872 bytes --]

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;
 	}
 
 	/*

  parent reply	other threads:[~2001-04-04 23:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-01  1:19 Xuan Baldauf
2001-04-03 20:06 ` Urban Widmark
2001-04-04 23:00 ` Urban Widmark [this message]
2001-04-05  1:29   ` Xuan Baldauf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.30.0104050032430.16277-200000@cola.teststation.com \
    --to=urban@teststation.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xuan--lkml@baldauf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®