The attached test program reliably fails on an NFSv4 mount. # mount -tnfs -onfsvers=4 127.0.0.1:/ /mnt/nfs # ./truncate-test /mnt/nfs/tmp/xyz truncate: Input/output error Thanks, Miklos
#include <stdio.h> #include <unistd.h> #include <fcntl.h> int main(int argc, char *argv[]) { int res; char *name = argv[1]; unlink(name); close(open(name, O_WRONLY | O_CREAT, 0644)); close(open(name, O_RDONLY)); res = truncate(name, 1); if (res == -1) { perror("truncate"); return 1; } return 0; }