All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.8.1 kernel NFS client connectathon failure
@ 2004-09-15 20:54 Andrew Schretter
  2004-09-15 22:23 ` vfs bug. was: Re: [NFS] " Frank van Maarseveen
  2004-09-16  3:11 ` Trond Myklebust
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Schretter @ 2004-09-15 20:54 UTC (permalink / raw)
  To: NFS

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

The attached code is a blatant rip from the latest connectathon code that
was stripped down to show exactly where it fails on my 2.6.8.1 NFS client.
Note that this code works on the local disk and on a 2.4.22 client (both to
a 2.6.8.1 server and a 2.4.22 server) but fail from a 2.6.8.1 client to
both 2.4.22 and 2.6.8.1 servers.

The problem has something to do with hard links and using rename(2) to
overwrite hard linked files.

Compile stright with gcc and run on a local disk partition and then on a
remote partition.  It creates a directory TEMP, creates a file FOO, links
it to TEMP/BAR, renames TEMP/BAR to FOO, then removes FOO and does an 
ls on FOO and TEMP/BAR. 

On local disk runs, TEMP/BAR still exists (I don't know why though).  On NFS
runs, it does not exists.  This breaks connectathon's test.

Any ideas?

Andrew Schretter
Systems Programmer, Duke University
Dept. of Mathematics (919) 660-2866



[-- Attachment #2: lnk.c --]
[-- Type: text/plain, Size: 1052 bytes --]

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/stat.h>

#ifndef MAXPATHLEN
#define MAXPATHLEN	128
#endif

/* maximum number of chars for the message string */
#define STRCHARS	100

main(int ac, char *av[]) {
	int count, fd, slen, lerr, slerr;
	char *fn;
	struct stat sb;
        char str[255];

        if (mkdir("TEMP", 0755)) {
        	perror("mkdir TEMP");
        	exit(0);
        }
	fd = open("FOO", O_RDWR|O_CREAT, 0666);
	if (fd < 0) {
		perror("creat");
		exit(0);
	}
        sprintf(str, "...");
        slen = strlen(str);
	if (write(fd, str, slen) != slen) {
		perror("write");
		(void) close(fd);
		exit(0);
	}
	if (close(fd)) {
		perror("close");
		exit(0);
	}
	if (lerr = link("FOO", "TEMP/BAR")) {
		if (errno != EOPNOTSUPP) {
			perror("link");
			exit(0);
		}
	} else if (rename("TEMP/BAR", "FOO")) {
		perror("rerename");
		exit(0);
	}
	if (unlink("FOO")) {
		perror("unlink 1");
		exit(0);
	}
        system("ls -l FOO TEMP/BAR");
	exit(errno);
}

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

end of thread, other threads:[~2004-09-18  1:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-15 20:54 2.6.8.1 kernel NFS client connectathon failure Andrew Schretter
2004-09-15 22:23 ` vfs bug. was: Re: [NFS] " Frank van Maarseveen
2004-09-15 23:02   ` viro
2004-09-16  3:11 ` Trond Myklebust
2004-09-17  1:41   ` Neil Brown
2004-09-17  1:54     ` Neil Brown
2004-09-17  3:14     ` Trond Myklebust
     [not found]       ` <20040917035515.GR23987@parcelfarce.linux.theplanet.co.uk>
2004-09-17 16:34         ` Trond Myklebust
     [not found]           ` <20040918001817.GX23987@parcelfarce.linux.theplanet.co.uk>
2004-09-18  1:23             ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.