svn commit: r217871 - head/sbin/mount

Bruce Evans brde at optusnet.com.au
Fri Feb 11 11:01:03 UTC 2011


On Thu, 10 Feb 2011, Doug Barton wrote:

> On 01/28/2011 01:06, Bruce Evans wrote:
>> The solaris server behaviour can't happen, except accidentally due to
>> races :-).  Since the FreeBSD client doesn't support the noatime flag
>> except to ignore it, it can't tell any server about it.
>
> I don't mean to be a pest, but I'm confused as to why I observed what I 
> observed if this is the case. I tested it a couple of times each way, so I'm 
> confident that I saw a difference with and without noatime when mounting a 
> solaris server.

I see no evidence of this.  You at least need to run a simple test like
the following:

%%%
#include <sys/stat.h>

#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>

int
main(void)
{
 	struct stat sb;
 	time_t now, then;
 	int fd;
 	char buf[1];

 	fd = open("foo", O_RDWR | O_CREAT | O_TRUNC, 0666);
 	assert(fd >= 0);
 	assert(write(fd, "", 1) == 1);
 	assert(fsync(fd) == 0);
 	assert(fstat(fd, &sb) == 0);
 	then = sb.st_atime;
 	for (;;) {
 		assert(lseek(fd, (off_t)0, SEEK_SET) == 0);
 		sleep(1);	/* increase if fs resolution is low or buggy */
 		assert(read(fd, buf, 1) == 1);
 		assert(fstat(fd, &sb) == 0);
 		now = sb.st_atime;
 		printf("now = %jd; then = %jd\n",
 		    (intmax_t)now, (intmax_t)then);
#if 0
 		assert(now >= then + 1);
#else
 		if (!(now >= then + 1))
 			printf("assert(now >= then + 1) would fail\n");
#endif
 		fflush(stdout);
 		then = now;
 	}
}
%%%

and, if this works, report the surprising nfs RPCs that make it work.
It didn't work with FreeBSD clients and servers of course.  There were
only GetAttr RPCs for the fstat()s, and no Read RPCs at all.

Bruce


More information about the svn-src-all mailing list