From: David Flynn <davidf@rd.bbc.co.uk>
To: linux-nfs@vger.kernel.org
Cc: David Flynn <davidf@rd.bbc.co.uk>
Subject: NFSv4: "Viminfo file is not writable" -- stat(2) uid/gid incorrect
Date: Wed, 8 Dec 2010 15:33:40 +0000 [thread overview]
Message-ID: <20101208153340.GD20844@rd.bbc.co.uk> (raw)
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
next reply other threads:[~2010-12-08 18:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-08 15:33 David Flynn [this message]
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
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=20101208153340.GD20844@rd.bbc.co.uk \
--to=davidf@rd.bbc.co.uk \
--cc=linux-nfs@vger.kernel.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