mail-index-lock.c (dovecot-2.3.16) | : | mail-index-lock.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
#include "lib.h" | #include "lib.h" | |||
#include "nfs-workarounds.h" | #include "nfs-workarounds.h" | |||
#include "mail-index-private.h" | #include "mail-index-private.h" | |||
#define MAIL_INDEX_SHARED_LOCK_TIMEOUT 120 | #define MAIL_INDEX_SHARED_LOCK_TIMEOUT 120 | |||
int mail_index_lock_fd(struct mail_index *index, const char *path, int fd, | int mail_index_lock_fd(struct mail_index *index, const char *path, int fd, | |||
int lock_type, unsigned int timeout_secs, | int lock_type, unsigned int timeout_secs, | |||
struct file_lock **lock_r) | struct file_lock **lock_r) | |||
{ | { | |||
const char *error; | ||||
int ret; | ||||
if (fd == -1) { | if (fd == -1) { | |||
i_assert(MAIL_INDEX_IS_IN_MEMORY(index)); | i_assert(MAIL_INDEX_IS_IN_MEMORY(index)); | |||
return 1; | return 1; | |||
} | } | |||
return file_wait_lock(fd, path, lock_type, index->set.lock_method, | struct file_lock_settings lock_set = { | |||
timeout_secs, lock_r); | .lock_method = index->set.lock_method, | |||
}; | ||||
ret = file_wait_lock(fd, path, lock_type, &lock_set, timeout_secs, | ||||
lock_r, &error); | ||||
if (ret < 0) | ||||
e_error(index->event, "%s", error); | ||||
return ret; | ||||
} | } | |||
void mail_index_flush_read_cache(struct mail_index *index, const char *path, | void mail_index_flush_read_cache(struct mail_index *index, const char *path, | |||
int fd, bool locked) | int fd, bool locked) | |||
{ | { | |||
if ((index->flags & MAIL_INDEX_OPEN_FLAG_NFS_FLUSH) == 0) | if ((index->flags & MAIL_INDEX_OPEN_FLAG_NFS_FLUSH) == 0) | |||
return; | return; | |||
/* Assume flock() is emulated with fcntl(), because that's how most | /* Assume flock() is emulated with fcntl(), because that's how most | |||
OSes work nowadays. */ | OSes work nowadays. */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 11 lines changed or added |