1
1

opal/util: handle a race condition in opal_os_dirpath_destroy

An file might have been destroyed by an other task between
readdir() and stat(), so simply ignore stat() failure.

That typically occurs when one task is removing the job_session_dir
and an other task is still removing its proc_session_dir.

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2016-11-24 10:45:48 +09:00
родитель 1a279c4ee9
Коммит 8fd1c3f0df

Просмотреть файл

@ -195,6 +195,15 @@ int opal_os_dirpath_destroy(const char *path,
filenm = opal_os_path(false, path, ep->d_name, NULL);
rc = stat(filenm, &buf);
if (0 > rc) {
/* Handle a race condition. filenm might have been deleted by an
* other process running on the same node. That typically occurs
* when one task is removing the job_session_dir and an other task
* is still removing its proc_session_dir.
*/
free(filenm);
continue;
}
if (S_ISDIR(buf.st_mode)) {
is_dir = true;
}