|
|
3604df |
From 59def4a06265b5aac4e5df331caf7d913cbd7f72 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Avra Sengupta <asengupt@redhat.com>
|
|
|
3604df |
Date: Fri, 9 Dec 2016 15:01:40 +0530
|
|
|
3604df |
Subject: [PATCH 238/246] snapshot/ganesha: Copy export.conf, only if
|
|
|
3604df |
ganesha.enable is on.
|
|
|
3604df |
|
|
|
3604df |
Status of the volume being exported via nfs ganesha, should be
|
|
|
3604df |
checked by checking if ganesha.enable is set or not, rather than
|
|
|
3604df |
deciding based on the errno of the stat
|
|
|
3604df |
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/16094
|
|
|
3604df |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
(cherry picked from commit 74322ce58b1c949e11cb0aa72bfded0e34422157)
|
|
|
3604df |
|
|
|
3604df |
Change-Id: Iaff786d9f77a2de1322ce8ccb4b80954f84d3373
|
|
|
3604df |
BUG: 1402774
|
|
|
3604df |
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/92781
|
|
|
3604df |
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
.../mgmt/glusterd/src/glusterd-snapshot-utils.c | 38 ++++++++++++++--------
|
|
|
3604df |
1 file changed, 25 insertions(+), 13 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
3604df |
index 81b9aa0..4a3a2f7 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
3604df |
@@ -3722,6 +3722,14 @@ glusterd_copy_nfs_ganesha_file (glusterd_volinfo_t *src_vol,
|
|
|
3604df |
GF_VALIDATE_OR_GOTO (this->name, src_vol, out);
|
|
|
3604df |
GF_VALIDATE_OR_GOTO (this->name, dest_vol, out);
|
|
|
3604df |
|
|
|
3604df |
+ if (glusterd_check_ganesha_export(src_vol) == _gf_false) {
|
|
|
3604df |
+ gf_msg_debug (this->name, 0, "%s is not exported via "
|
|
|
3604df |
+ "NFS-Ganesha. Skipping copy of export conf.",
|
|
|
3604df |
+ src_vol->volname);
|
|
|
3604df |
+ ret = 0;
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
if (src_vol->is_snap_volume) {
|
|
|
3604df |
GLUSTERD_GET_SNAP_DIR (snap_dir, src_vol->snapshot, priv);
|
|
|
3604df |
ret = snprintf (src_path, PATH_MAX, "%s/export.%s.conf",
|
|
|
3604df |
@@ -3735,19 +3743,15 @@ glusterd_copy_nfs_ganesha_file (glusterd_volinfo_t *src_vol,
|
|
|
3604df |
|
|
|
3604df |
ret = sys_lstat (src_path, &stbuf);
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
- /* *
|
|
|
3604df |
- * If export file is not present, volume is not exported
|
|
|
3604df |
- * via ganesha. So it is not necessary to copy that during
|
|
|
3604df |
- * snapshot.
|
|
|
3604df |
- */
|
|
|
3604df |
- if (errno == ENOENT) {
|
|
|
3604df |
- ret = 0;
|
|
|
3604df |
- gf_msg_debug (this->name, 0, "%s not found", src_path);
|
|
|
3604df |
- } else
|
|
|
3604df |
- gf_msg (this->name, GF_LOG_WARNING, errno,
|
|
|
3604df |
- GD_MSG_FILE_OP_FAILED,
|
|
|
3604df |
- "Stat on %s failed with %s",
|
|
|
3604df |
- src_path, strerror (errno));
|
|
|
3604df |
+ /*
|
|
|
3604df |
+ * This code path is hit, only when the src_vol is being *
|
|
|
3604df |
+ * exported via NFS-Ganesha. So if the conf file is not *
|
|
|
3604df |
+ * available, we fail the snapshot operation. *
|
|
|
3604df |
+ */
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
3604df |
+ GD_MSG_FILE_OP_FAILED,
|
|
|
3604df |
+ "Stat on %s failed with %s",
|
|
|
3604df |
+ src_path, strerror (errno));
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
@@ -3778,6 +3782,14 @@ glusterd_copy_nfs_ganesha_file (glusterd_volinfo_t *src_vol,
|
|
|
3604df |
src = fopen (src_path, "r");
|
|
|
3604df |
dest = fopen (dest_path, "w");
|
|
|
3604df |
|
|
|
3604df |
+ if (!src || !dest) {
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
3604df |
+ GD_MSG_FILE_OP_FAILED,
|
|
|
3604df |
+ "Failed to open %s",
|
|
|
3604df |
+ dest ? src_path : dest_path);
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
/* *
|
|
|
3604df |
* if the source volume is snapshot, the export conf file
|
|
|
3604df |
* consists of orginal volname
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|