public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Hal Rosenstock
	<hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
	"linux-rdma
	(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Vladimir Koushnir
	<vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Jim Mott <jim-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH opensm] Add support for synchronizing in memory files with storage
Date: Sat, 21 Dec 2013 10:49:48 +0100	[thread overview]
Message-ID: <52B5643C.7070806@acm.org> (raw)
In-Reply-To: <52B4C553.9030109-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2013-12-21  9:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 22:31 [PATCH opensm] Add support for synchronizing in memory files with storage Hal Rosenstock
     [not found] ` <52B4C553.9030109-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-12-21  9:49   ` Bart Van Assche [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B5643C.7070806@acm.org \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=jim-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox