summaryrefslogtreecommitdiff
path: root/mysys/my_sync.c
diff options
context:
space:
mode:
authorserg@serg.mylan <>2005-04-05 13:17:49 +0200
committerserg@serg.mylan <>2005-04-05 13:17:49 +0200
commit810b2c3d4059d0a03c1fcf48a9823db8a5dd5c6c (patch)
treea9dd96a05ad4e0e84d0b4f7711b882492d5ea59d /mysys/my_sync.c
parent2b8ff6949f5f9abe83aa308e2e942ac4c6ed6f4b (diff)
downloadmariadb-git-810b2c3d4059d0a03c1fcf48a9823db8a5dd5c6c.tar.gz
remove the rest of isam/merge references
fix a race condition in TC_LOG_BINLOG::unlog
Diffstat (limited to 'mysys/my_sync.c')
-rw-r--r--mysys/my_sync.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index bd372f03c87..bfaf09ce402 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -27,7 +27,14 @@
my_flags Flags (now only MY_WME is supported)
NOTE
- If file system supports its, only file data is synced, not inode date
+ If file system supports its, only file data is synced, not inode data.
+
+ MY_IGNORE_BADFD is useful when fd is "volatile" - not protected by a
+ mutex. In this case by the time of fsync(), fd may be already closed by
+ another thread, or even reassigned to a different file. With this flag -
+ MY_IGNORE_BADFD - such a situation will not be considered an error.
+ (which is correct behaviour, if we know that the other thread synced the
+ file before closing)
RETURN
0 ok
@@ -55,10 +62,15 @@ int my_sync(File fd, myf my_flags)
if (res)
{
- if (!(my_errno= errno))
- my_errno= -1; /* Unknown error */
- if (my_flags & MY_WME)
+ int er= errno;
+ if (!(my_errno= er))
+ my_errno= -1; /* Unknown error */
+ if (my_flags & MY_IGNORE_BADFD &&
+ (er == EBADF || er == EINVAL || er == EROFS))
+ res= 0;
+ else if (my_flags & MY_WME)
my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno);
}
DBUG_RETURN(res);
-} /* my_read */
+} /* my_sync */
+