NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all;

On an NFS4 client (mounting a solaris ufs export), for a long time i've
been experiencing vim complaining when exiting:
  E137: Viminfo file is not writable: /home/davidf/.viminfo

Further examination has revealed this to occur when vim has been used on
multiple systems using the same nfs filesystem.  Vim tries to identify if it
has permission to modify .viminfo by stat'ing it, whereupon stat returns
an incorrect st_uid/st_gid and vim gives up.

Assuming two systems (A and B) with clean caches:
  A> vim
  :q
  B> vim
  :q
  A> vim
  :q
  E137: ...
  A> vim
  :q
  E137: ...

It should be noted that:
 - (A) must be using nfs4, although sec=sys/sec=krb5 do not affect behaviour.
 - (B) can be nfs4 or nfs3 (or possibly anything else)
 - Dropping caches on (A) will clear the fault

This fault is very reproducible using kernel 2.6.35.  I'm also able to
reproduce on 2.6.32.11  I have not been able to reproduce on a 2.6.26 system.

More succinctly, the following transcript reproduces the problem.
  - vcfe0 corresponds to (A) above.
  - lxg1 corresponds to (B) above.
  - ~/test-stat-open-stat is a program that does:
       stat(argv[1], &st);
       printf("stat(\".%s\"...), st_uid=%u, st_gid=%u\n",
              argv[1], st.st_uid, st.st_gid);

       int fd = open(argv[1], O_RDONLY);
       printf("open(\"%s\", O_RDONLY) = %d\n", argv[1], fd);
       stat(argv[1], &st);
       printf("stat(\".%s\"...), st_uid=%u, st_gid=%u\n",
              argv[1], st.st_uid, st.st_gid);

       close(fd);
       printf("close(%d)\n", fd);
       stat(argv[1], &st);
       printf("stat(\".%s\"...), st_uid=%u, st_gid=%u\n",
              argv[1], st.st_uid, st.st_gid);

vcfe0:~/z$ bash <<EOF
echo === truncate === ; \
echo foo >.file ; \
echo === remote unlink, create === ; \
ssh lxg1 "rm $PWD/.file; echo barbar >$PWD/.file" ; \
echo === 'stat(1)' === ; \
stat .file ; \
echo === stat,open,stat,close,stat === ; \
~/test-stat-open-stat .file ; \
echo === 'stat(1)' === ; \
stat .file
EOF

=== truncate ===
=== remote unlink, create ===
=== stat(1) ===
  File: `.file'
  Size: 4               Blocks: 0          IO Block: 1048576 regular file
Device: 18h/24d Inode: 5678963     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1179/  davidf)   Gid: ( 1000/      rd)
Access: 2010-11-29 16:50:03.414109000 +0000
Modify: 2010-11-29 17:00:17.698839000 +0000
Change: 2010-11-29 17:00:17.698839000 +0000
=== stat,open,stat,close,stat ===
stat(".file"...), st_uid=1179, st_gid=1000
open(".file", O_RDONLY) = 3
stat(".file"...), st_uid=4294967294, st_gid=4294967294
close(3)
stat(".file"...), st_uid=4294967294, st_gid=4294967294
=== stat(1) ===
  File: `.file'
  Size: 7               Blocks: 2          IO Block: 1048576 regular file
Device: 18h/24d Inode: 5678906     Links: 1
Access: (0644/-rw-r--r--)  Uid: (4294967294/ UNKNOWN)   Gid: (4294967294/ UNKNOWN)
Access: 2010-11-29 17:00:18.059076000 +0000
Modify: 2010-11-29 17:00:18.064360000 +0000
Change: 2010-11-29 17:00:18.064360000 +0000

Kind regards,

..david
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux