-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello there! In os_unix.c, the following logic appears in unixSync: /* Also fsync the directory containing the file if the DIRSYNC flag ** is set. This is a one-time occurrance. Many systems (examples: AIX) ** are unable to fsync a directory, so ignore errors on the fsync. */ if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){ int dirfd; OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath, HAVE_FULLFSYNC, isFullsync)); rc = osOpenDirectory(pFile->zPath, &dirfd); if( rc==SQLITE_OK && dirfd>=0 ){ full_fsync(dirfd, 0, 0); robust_close(pFile, dirfd, __LINE__); }else if( rc==SQLITE_CANTOPEN ){ rc = SQLITE_OK; } pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC; } return rc; This is all well and good, as indeed, fsync on directories often fails on AIX (although, amusingly, it sometimes succeeds as well). However, unixDelete has the following logic: #ifndef SQLITE_DISABLE_DIRSYNC if( dirSync ){ int fd; rc = osOpenDirectory(zPath, &fd); if( rc==SQLITE_OK ){ #if OS_VXWORKS if( fsync(fd)==-1 ) #else if( fsync(fd) ) #endif { rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath); } robust_close(0, fd, __LINE__); }else if( rc==SQLITE_CANTOPEN ){ rc = SQLITE_OK; } } #endif return rc; Unfortunately, this does not ignore directory fsync errors. This means that committing on AIX will fail unless the directory sync succeeded. As far as we can tell, fsync on a dir on AIX succeeds if no other files have been created in the directory "recently" (although we're not sure how recent that has to be), and fails with EBADF otherwise! Therefore, I respectfully suggest that unixDelete be altered to silently ignore errors on directory fsyncs! I can't find anywhere else that fsync is called on directories. Thanks, ABS - -- Alaric Snell-Pym http://www.snell-pym.org.uk/alaric/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7WApEACgkQRgz/WHNxCGqhewCgk+sYT9Dkwc+vq3Z0S8SJD0eb 05IAn3Rxol3qzNKju7/hLeQPRKISW28t =oVaA -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users