[sheepdog] [PATCH 3/3] journal: clean journal files when sheep exits correctly

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Apr 10 09:52:32 CEST 2013


At Wed, 10 Apr 2013 13:36:10 +0800,
Liu Yuan wrote:
> 
> On 04/10/2013 12:32 AM, Hitoshi Mitake wrote:
> > +void clean_journal_file(const char *p)
> > +{
> > +	int ret;
> > +	char path[PATH_MAX];
> > +
> > +	snprintf(path, sizeof(path), "%s/%s", p, jfile_name[0]);
> > +	ret = unlink(path);
> > +	if (ret < 0)
> > +		sd_eprintf("unlink(%s): %m", path);
> > +
> > +	snprintf(path, sizeof(path), "%s/%s", p, jfile_name[1]);
> > +	ret = unlink(path);
> > +	if (ret < 0)
> > +		sd_eprintf("unlink(%s): %m", path);
> > +}
> 
> We need call sync() to assure the data reach the disks before unlink()
> the jfile.

Thanks for your pointing. I'll add sync() in the v2.

Thanks,
Hitoshi



More information about the sheepdog mailing list