Bug 43839

Summary: (FS SMBFS)Files that already contains data on samba mounted volumes can not be truncated when running kernel version 2.2.19-7.0.1
Product: [Retired] Red Hat Linux Reporter: Kjell Uddeborg <kjell>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED CURRENTRELEASE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: goeran, teg
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4.20-19.7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-11 20:57:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kjell Uddeborg 2001-06-07 14:54:55 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Description of problem:
When mounting a samba volume, files that already contains data can not be 
truncated. Problem occurs with kernel version 2.2.19-7.0.1. With kernel 
version 2.2.17-14 the problem does not exist. I have not tried with the 
latest 2.4 kernel yet.

How reproducible:
Always

Steps to Reproduce:
1.Run the included program on a system with kernel 2.2.19-7.0.1.
2.As command line argument specify a file on a samba mounted volume.
3.Make sure that the file already contains some data like the alphabet for 
example.
	

Actual Results:  ftruncate: Permission denied

Expected Results:  No error message

Additional info:

int main(int argc, char *argv[])
{
  int fd, i;
  char buf[20];
  
  if (argc != 2)
    {
      fprintf(stderr, "usage: %s file\n", argv[0]);
      return 1;
    }
  if ((fd = open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0)
    {
      perror("open");
      return 1;
    }
  if (read(fd, buf, sizeof buf) == -1)
    {
      perror("read");
      return 1;
    }
  if (ftruncate(fd, 0) == -1)
    {
      perror("ftruncate");
      return 1;
    }
  return 0;
}

Comment 1 Kjell Uddeborg 2001-06-07 15:04:29 UTC
Titel incorrect, sould read:

Files that already contains data on samba mounted volumes can not be truncated 
when running kernel version 2.2.19-7.0.1

Comment 2 Trond Eivind Glomsrxd 2001-06-08 16:41:11 UTC
It works for with client RHL 7.1 and server RHL 6.2 (running 2.2.19-6.2.1, which
is the same kernel with some packaging changes for RHL 6.x):

//oslo.devel.redhat.com/tmp /fooo smbfs rw 0 0

[root@halden /fooo]# ls -l
totalt 1
-rwxr-xr-x    1 root     root            4 jun  8 12:38 ab
-rwxr-xr-x    1 root     root           30 jun  8 12:33 foo2
[root@halden /fooo]# ~teg/foo4 ab
[root@halden /fooo]# ls -l
totalt 1
-rwxr-xr-x    1 root     root            0 jun  8 12:38 ab
-rwxr-xr-x    1 root     root           30 jun  8 12:33 foo2
[root@halden /fooo]#

Same when mounting the 6.2 system on itself...

Comment 3 Göran Uddeborg 2001-06-10 21:10:53 UTC
To clarify things, this happens with the 7.0 machine as client.  The server was
an NT.


Comment 4 Trond Eivind Glomsrxd 2001-06-10 21:26:47 UTC
Samba is a server application only... reopening, and changing to kernel component.


Comment 5 Kjell Uddeborg 2001-06-11 15:42:54 UTC
Just to clarify things a little bit more, probably does not make much 
difference:
The server is not an NT4 machine but a Windows 2000 machine.


Comment 6 Kjell Uddeborg 2003-08-11 20:57:26 UTC
Works fine in version 2.4.20-19.7.