view src/lib/nfs-workarounds.h @ 6797:a59deefc552f HEAD

NFS attribute cache flushing fixes. nfs_flush_attr_cache() takes now flush_dir parameter and nfs_flush_attr_cache_fd() returns FALSE if file handle is already stale.
author Timo Sirainen <tss@iki.fi>
date Wed, 14 Nov 2007 23:52:33 +0200
parents e4eb71ae8e96
children 9bc620b934f4
line wrap: on
line source

#ifndef NFS_WORKAROUNDS_H
#define NFS_WORKAROUNDS_H

/* Note that some systems (Solaris) may use a macro to redefine struct stat */
#include <sys/stat.h>

/* When syscall fails with ESTALE error, how many times to try reopening the
   file and retrying the operation. */
#define NFS_ESTALE_RETRY_COUNT 10

/* Same as open(), but try to handle ESTALE errors. */
int nfs_safe_open(const char *path, int flags);
/* Same as stat(), but try to handle ESTALE errors.
   Doesn't flush attribute cache. */
int nfs_safe_stat(const char *path, struct stat *buf);
int nfs_safe_lstat(const char *path, struct stat *buf);

/* Flush attribute cache for given path. If flush_dir is TRUE, also the
   directory's cache is flushed. */
void nfs_flush_attr_cache(const char *path, bool flush_dir);
/* Flush attribute cache for given file descriptor.
   The given path is used only for logging. */
bool nfs_flush_attr_cache_fd(const char *path, int fd);
/* Flush read cache for given fd. lock_type must be set to the file's current
   fcntl locking state (F_UNLCK, F_RDLCK, F_WRLCK). Set just_locked=TRUE if the
   file was locked at the same time as read cache flush was wanted (to avoid
   re-locking the file unneededly). */
void nfs_flush_read_cache(const char *path, int fd,
			  int lock_type, bool just_locked);

#endif