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

Liu Yuan namei.unix at gmail.com
Wed Apr 10 07:36:10 CEST 2013


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,
Yuan



More information about the sheepdog mailing list