geo-rep/libgfchangelog: Create working dir during changelog_register if not present.
Earlier, xysnc's register was being called first, which was creating working directory before calling changelog_register. Now it is history crawl first. Hence working directory would not have been created. Create it in gf_changelog_register itself if it is not already created. Change-Id: Ief3f2b87deaf5da16c135b64be1be42e0a7647f3 BUG: 1125843 Signed-off-by: Kotresh H R <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/8399 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
b12ee8fbaf
commit
d09f69e76f
@ -440,12 +440,13 @@ int
|
||||
gf_changelog_register (char *brick_path, char *scratch_dir,
|
||||
char *log_file, int log_level, int max_reconnects)
|
||||
{
|
||||
int i = 0;
|
||||
int ret = -1;
|
||||
int errn = 0;
|
||||
xlator_t *this = NULL;
|
||||
gf_changelog_t *gfc = NULL;
|
||||
char hist_scratch_dir[PATH_MAX] = {0,};
|
||||
int i = 0;
|
||||
int ret = -1;
|
||||
int errn = 0;
|
||||
xlator_t *this = NULL;
|
||||
gf_changelog_t *gfc = NULL;
|
||||
char hist_scratch_dir[PATH_MAX] = {0,};
|
||||
struct stat buf = {0,};
|
||||
|
||||
this = THIS;
|
||||
if (!this->ctx)
|
||||
@ -463,6 +464,14 @@ gf_changelog_register (char *brick_path, char *scratch_dir,
|
||||
gfc->gfc_dir = NULL;
|
||||
gfc->gfc_fd = gfc->gfc_sockfd = -1;
|
||||
|
||||
if (stat (scratch_dir, &buf) && errno == ENOENT) {
|
||||
ret = mkdir_p (scratch_dir, 0600, _gf_false);
|
||||
if (ret) {
|
||||
errn = errno;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
gfc->gfc_working_dir = realpath (scratch_dir, NULL);
|
||||
if (!gfc->gfc_working_dir) {
|
||||
errn = errno;
|
||||
|
Loading…
x
Reference in New Issue
Block a user