comparison src/lib/file-dotlock.c @ 6857:41911abe6fa7 HEAD

NFS cache flushing updates.
author Timo Sirainen <tss@iki.fi>
date Sun, 25 Nov 2007 15:47:36 +0200
parents dbab5e592577
children 94e94e3b5b30
comparison
equal deleted inserted replaced
6856:a249d916f6e6 6857:41911abe6fa7
156 { 156 {
157 struct stat st; 157 struct stat st;
158 158
159 /* don't waste time flushing attribute cache the first time we're here. 159 /* don't waste time flushing attribute cache the first time we're here.
160 if it's stale we'll get back here soon. */ 160 if it's stale we'll get back here soon. */
161 if (lock_info->set->nfs_flush && lock_info->lock_stated) 161 if (lock_info->set->nfs_flush && lock_info->lock_stated) {
162 nfs_flush_file_handle_cache(lock_info->lock_path);
162 nfs_flush_attr_cache_unlocked(lock_info->lock_path); 163 nfs_flush_attr_cache_unlocked(lock_info->lock_path);
164 }
163 165
164 lock_info->lock_stated = TRUE; 166 lock_info->lock_stated = TRUE;
165 if (nfs_safe_lstat(lock_info->lock_path, &st) < 0) { 167 if (nfs_safe_lstat(lock_info->lock_path, &st) < 0) {
166 if (errno != ENOENT) { 168 if (errno != ENOENT) {
167 i_error("lstat(%s) failed: %m", lock_info->lock_path); 169 i_error("lstat(%s) failed: %m", lock_info->lock_path);
246 if (now > lock_info->last_change + stale_timeout) { 248 if (now > lock_info->last_change + stale_timeout) {
247 struct stat st; 249 struct stat st;
248 250
249 /* possibly stale lock file. check also the timestamp of the 251 /* possibly stale lock file. check also the timestamp of the
250 file we're protecting. */ 252 file we're protecting. */
251 if (lock_info->set->nfs_flush) 253 if (lock_info->set->nfs_flush) {
254 nfs_flush_file_handle_cache(lock_info->path);
252 nfs_flush_attr_cache_maybe_locked(lock_info->path); 255 nfs_flush_attr_cache_maybe_locked(lock_info->path);
256 }
253 if (nfs_safe_stat(lock_info->path, &st) < 0) { 257 if (nfs_safe_stat(lock_info->path, &st) < 0) {
254 if (errno == ENOENT) { 258 if (errno == ENOENT) {
255 /* file doesn't exist. treat it as if 259 /* file doesn't exist. treat it as if
256 it hasn't changed */ 260 it hasn't changed */
257 } else { 261 } else {