Skip to contentSkip to conversation

NFSv4 close-to-open attr cache flushing broken in 2.6.23

NFS Timo Sirainen 1 participant 1 message Nov 23, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

In v2.6.23 (but not in v2.6.22) a file's attribute cache doesn't get flushed with close()+open() if the file is open in any process on the same server. Test program below demonstrates it.

BTW. I thought delegations were supposed to fix most of these caching issues automatically? I don't see any difference in caching behavior compared to NFSv3 (Linux 2.6.23 as NFS server).

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

int main(void)

{
	int fd = open("foo", O_RDWR | O_CREAT, 0600);
	int fd2 = open("foo", O_RDWR);
	struct stat st;
	char buf[1024];

	if (fstat(fd2, &st) < 0) perror("fstat()");
	printf("mtime before = %ld\n", st.st_mtime);

	printf("now modify the file on server\n");
	fgets(buf, sizeof(buf), stdin);

	close(fd2);
	fd2 = open("foo", O_RDWR);
	if (fstat(fd2, &st) < 0) perror("fstat()");
	printf("mtime after = %ld\n", st.st_mtime);
	return 0;
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that [email protected] is being discontinued. Please subscribe to [email protected] instead.
http://vger.kernel.org/vger-lists.html#linux-nfs