diff options
author | Sergey Vojtovich <svoj@sun.com> | 2009-11-03 13:59:31 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@sun.com> | 2009-11-03 13:59:31 +0400 |
commit | 9cdf2ea1ff525fb8b0299afdd6ff9b12d196296a (patch) | |
tree | fba5c22f54d4c73d76e1e85e47d818334f737fd4 /storage | |
parent | bcb97ed6d38a512bb917cd133e1f31dd3479d7a3 (diff) | |
download | mariadb-git-9cdf2ea1ff525fb8b0299afdd6ff9b12d196296a.tar.gz |
Applying InnoDB plugin snashot
Detailed revision comments:
r6048 | vasil | 2009-10-09 08:42:55 +0300 (Fri, 09 Oct 2009) | 16 lines
branches/zip:
When scanning a directory readdir() is called and stat() after it,
if a file is deleted between the two calls stat will fail and the
whole precedure will fail. Change this behavior to continue with the
next entry if stat() fails because of nonexistent file. This is
transparent change as it will make it look as if the file was deleted
before the readdir() call.
This change is needed in order to fix
https://svn.innodb.com/mantis/view.php?id=174
in which we need to abort if os_file_readdir_next_file()
encounters "real" errors.
Approved by: Marko, Pekka (rb://177)
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innodb_plugin/os/os0file.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index a1d3bad2add..0cb76d1796f 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -832,6 +832,23 @@ next_file: ret = stat(full_path, &statinfo); if (ret) { + + if (errno == ENOENT) { + /* readdir() returned a file that does not exist, + it must have been deleted in the meantime. Do what + would have happened if the file was deleted before + readdir() - ignore and go to the next entry. + If this is the last entry then info->name will still + contain the name of the deleted file when this + function returns, but this is not an issue since the + caller shouldn't be looking at info when end of + directory is returned. */ + + ut_free(full_path); + + goto next_file; + } + os_file_handle_error_no_exit(full_path, "stat"); ut_free(full_path); |