NFS truncates files

Galen Sampson galen_sampson at yahoo.com
Tue Oct 7 11:27:07 PDT 2003


All,
   I have a home directory mount via nfs.  The nfs server does not have
-maproot set so root's uid/gid are mapped to -2 (at least according to the man
page).  When I edit a file in my home directory I receive "permission
denied:file truncated" upon a write.  File and directory creation is not
affected, only the modification of the file.  The uid attempting to modify
these thing the file is 1000.  If I set -maproot=root on the server everything
behaves as expected.
   I believe src/sys/vfs/nfs_vnops.c to be the source of the problem.  Version
1.10 of this file is supposed to fix a file truncation problem.  Version 1.12
of this file contains changes related to the vfs work that is in progress.
   Example:

Script started on Tue Oct  7 10:46:33 2003
[1] mars:~/projects/libcr> cat > file << X
? hello world
? X
cat: stdout: Permission denied
[2] mars:~/projects/libcr> exit
exit
 
Script done on Tue Oct  7 10:46:57 2003

   And a ktrace dump of a vi session:
   448 vi       RET   read 1
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff638,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff638,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0xa)
   448 vi       GIO   fd 1 wrote 10 bytes
       "\r\^[[25d:\^[[K"
   448 vi       RET   write 10/0xa
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  read(0,0x808e000,0xff)
   448 vi       GIO   fd 0 read 1 byte
       "w"
   448 vi       RET   read 1
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff638,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff638,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0x1)
   448 vi       GIO   fd 1 wrote 1 byte
       "w"
   448 vi       RET   write 1
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  read(0,0x808e000,0xff)
   448 vi       GIO   fd 0 read 1 byte
       "\r"
   448 vi       RET   read 1
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff838,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff838,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0x1)
   448 vi       GIO   fd 1 wrote 1 byte
       "\r"
   448 vi       RET   write 1
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  stat(0x80931a0,0xbfbff7a0)
   448 vi       NAMI  "file"
   448 vi       RET   stat 0
   448 vi       CALL  open(0x80931a0,0x601,0x1b6)
   448 vi       NAMI  "file"
   448 vi       RET   open 7
   448 vi       CALL  fcntl(0x7,0x3,0)
   448 vi       RET   fcntl 1
   448 vi       CALL  fstat(0x7,0xbfbff080)
   448 vi       RET   fstat 0
   448 vi       CALL  write(0x7,0x80ae200,0xc)
   448 vi       GIO   fd 7 wrote 12 bytes
       "hello world
       "
   448 vi       RET   write 12/0xc
   448 vi       CALL  fstat(0x7,0xbfbff220)
   448 vi       RET   fstat 0
   448 vi       CALL  fsync(0x7)
   448 vi       RET   fsync -1 errno 13 Permission denied
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff088,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff088,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0x26)
   448 vi       GIO   fd 1 wrote 38 bytes
       "\^[[7mError: file: Permission denied\r\^[[m"
   448 vi       RET   write 38/0x26
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  close(0x7)
   448 vi       RET   close 0
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff128,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff128,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  stat(0x80931a0,0xbfbff7a0)
   448 vi       NAMI  "file"
   448 vi       RET   stat 0
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff148,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff148,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0x33)
   448 vi       GIO   fd 1 wrote 51 bytes
       "\^[[31`\^[[7m;\^[[m \^[[7mfile: WARNING: FILE TRUNCATED\r\^[[m"
   448 vi       RET   write 51/0x33
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  sigaction(0x12,0x280e7b94,0x280e7bac)
   448 vi       RET   sigaction 0
   448 vi       CALL  poll(0xbfbff7f8,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  poll(0xbfbff7f8,0x1,0)
   448 vi       RET   poll 0
   448 vi       CALL  write(0x1,0x80a5000,0x14)
   448 vi       GIO   fd 1 wrote 20 bytes
       "\^[[62`\^[[7m.\^[[1;11H\^[[m"
   448 vi       RET   write 20/0x14
   448 vi       CALL  sigaction(0x12,0x280e7bac,0)
   448 vi       RET   sigaction 0
   448 vi       CALL  read(0,0x808e000,0xff)

regards,
Galen Sampson

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com





More information about the Bugs mailing list