diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 905ac6e0c..e8ae05851 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5013,35 +5013,33 @@ glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo) char *device = NULL; FILE *mtab = NULL; struct mntent *entry = NULL; + xlator_t *this = NULL; - ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt); - if (ret) - goto out; + this = THIS; + GF_ASSERT (this); + GF_ASSERT (brickinfo); - mtab = setmntent (_PATH_MOUNTED, "r"); - if (!mtab) { - ret = -1; + ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to get mount point " + "for %s brick", brickinfo->path); goto out; } - entry = getmntent (mtab); - - while (1) { - if (!entry) { - ret = -1; - goto out; - } - if (!strcmp (entry->mnt_dir, mnt_pt) && - strcmp (entry->mnt_type, "rootfs")) - break; - entry = getmntent (mtab); + entry = glusterd_get_mnt_entry_info (mnt_pt, mtab); + if (NULL == entry) { + gf_log (this->name, GF_LOG_ERROR, "Failed to get mnt entry " + "for %s mount path", mnt_pt); + goto out; } - /* get the fs_name/device */ device = gf_strdup (entry->mnt_fsname); out: + if (NULL != mtab) { + endmntent (mtab); + } return device; } |