Linux NFS development
 help / color / mirror / Atom feed
* NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect
@ 2010-12-08 15:33 David Flynn
  2010-12-08 15:48 ` can't dump core on NFSv4 mounts David Flynn
  2010-12-08 19:19 ` NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect Trond Myklebust
  0 siblings, 2 replies; 7+ messages in thread
From: David Flynn @ 2010-12-08 15:33 UTC (permalink / raw)
  To: linux-nfs; +Cc: David Flynn

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-09 13:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 15:33 NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect David Flynn
2010-12-08 15:48 ` can't dump core on NFSv4 mounts David Flynn
2010-12-08 19:19 ` NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect Trond Myklebust
2010-12-08 20:20   ` David Flynn
2010-12-08 20:45     ` Trond Myklebust
2010-12-08 21:19       ` David Flynn
2010-12-09 13:11         ` David Flynn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox