On 12/20/13 23:31, Hal Rosenstock wrote:
> -int osm_db_store(IN osm_db_domain_t * p_domain)
> +int osm_db_store(IN osm_db_domain_t * p_domain,
> +              IN boolean_t fsync_high_avail_files)
>  {
>       osm_log_t *p_log = p_domain->p_db->p_log;
>       osm_db_domain_imp_t *p_domain_imp;
>       FILE *p_file = NULL;
> -     int status = 0;
> +     int fd, status = 0;
>       char *p_tmp_file_name = NULL;
>  
>       OSM_LOG_ENTER(p_log);
> @@ -494,6 +496,21 @@ int osm_db_store(IN osm_db_domain_t * p_domain)
>       }
>  
>       st_foreach(p_domain_imp->p_hash, dump_tbl_entry, (st_data_t) p_file);
> +
> +     if (fsync_high_avail_files) {
> +             fd = fileno(p_file);
> +             if (fd != -1) {
> +                     if (fsync(fd) == -1)
> +                             OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6110: "
> +                                     "fsync failed (%s) for %s\n",
> +                                     strerror(errno),
> +                                     p_domain_imp->file_name);
> +             } else
> +                     OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6111: "
> +                             "fileno() failed for %s\n",
> +                             p_domain_imp->file_name);
> +     }
> +
>       fclose(p_file);
>  
>       status = rename(p_tmp_file_name, p_domain_imp->file_name);

Shouldn't fflush() be invoked before calling fsync() ? Sorry that I
wasn't more explicit in my previous review comment. A complete example
can be found on slide 87 of
https://www.flamingspork.com/talks/2007/06/eat_my_data.odp.

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to