summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2014-11-13 15:13:39 +0530
committerVijay Bellur <vbellur@redhat.com>2014-11-13 06:55:11 -0800
commitb4597a92ccfebf362c63977bc4bada7b65e28753 (patch)
tree1a447813d4c4ab95125c217139a65d602fcceeff /xlators/features/snapview-server
parent75474f148daada475c235d0acaf345acad4ba9f3 (diff)
uss/gluster: creating file/directories inside .snaps should fail with
EROFS When an attempt is made to create file/directories inside .snaps, it fails with wrong error message as "Stale file handle". It should fail with "Read-only file system" Change-Id: I3a812a0afc4762cbb71ab180b9394c866e576a66 BUG: 1159840 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/9039 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server')
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c19
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c5
-rw-r--r--xlators/features/snapview-server/src/snapview-server.h6
3 files changed, 20 insertions, 10 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
index fdabc00..a8183e3 100644
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
@@ -426,10 +426,12 @@ __svs_get_snap_dirent (xlator_t *this, const char *name)
}
glfs_t *
-__svs_initialise_snapshot_volume (xlator_t *this, const char *name)
+__svs_initialise_snapshot_volume (xlator_t *this, const char *name,
+ int32_t *op_errno)
{
svs_private_t *priv = NULL;
int32_t ret = -1;
+ int32_t local_errno = ESTALE;
snap_dirent_t *dirent = NULL;
char volname[PATH_MAX] = {0, };
glfs_t *fs = NULL;
@@ -446,6 +448,7 @@ __svs_initialise_snapshot_volume (xlator_t *this, const char *name)
if (!dirent) {
gf_log (this->name, GF_LOG_ERROR, "snap entry for "
"name %s not found", name);
+ local_errno = ENOENT;
goto out;
}
@@ -464,6 +467,7 @@ __svs_initialise_snapshot_volume (xlator_t *this, const char *name)
gf_log (this->name, GF_LOG_ERROR,
"glfs instance for snap volume %s "
"failed", dirent->name);
+ local_errno = ENOMEM;
goto out;
}
@@ -497,8 +501,12 @@ __svs_initialise_snapshot_volume (xlator_t *this, const char *name)
ret = 0;
out:
- if (ret && fs) {
- glfs_fini (fs);
+ if (ret) {
+ if (op_errno)
+ *op_errno = local_errno;
+
+ if (fs)
+ glfs_fini (fs);
fs = NULL;
}
@@ -510,7 +518,8 @@ out:
}
glfs_t *
-svs_initialise_snapshot_volume (xlator_t *this, const char *name)
+svs_initialise_snapshot_volume (xlator_t *this, const char *name,
+ int32_t *op_errno)
{
glfs_t *fs = NULL;
svs_private_t *priv = NULL;
@@ -523,7 +532,7 @@ svs_initialise_snapshot_volume (xlator_t *this, const char *name)
LOCK (&priv->snaplist_lock);
{
- fs = __svs_initialise_snapshot_volume (this, name);
+ fs = __svs_initialise_snapshot_volume (this, name, op_errno);
}
UNLOCK (&priv->snaplist_lock);
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 8921909..2f15f5e 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -211,13 +211,12 @@ svs_lookup_snapshot (xlator_t *this, loc_t *loc, struct iatt *buf,
GF_VALIDATE_OR_GOTO (this->name, parent_ctx, out);
GF_VALIDATE_OR_GOTO (this->name, parent, out);
- fs = svs_initialise_snapshot_volume (this, loc->name);
+ fs = svs_initialise_snapshot_volume (this, loc->name, op_errno);
if (!fs) {
gf_log (this->name, GF_LOG_ERROR, "failed to "
"create the fs instance for snap %s",
loc->name);
op_ret = -1;
- *op_errno = ESTALE;
goto out;
}
@@ -534,7 +533,7 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
dirent = svs_get_latest_snap_entry (this);
if (dirent && !dirent->fs) {
- fs = svs_initialise_snapshot_volume (this, dirent->name);
+ fs = svs_initialise_snapshot_volume (this, dirent->name, NULL);
}
/* lookup is on the entry point to the snapshot world */
diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h
index 6033c0e..9c13cf7 100644
--- a/xlators/features/snapview-server/src/snapview-server.h
+++ b/xlators/features/snapview-server/src/snapview-server.h
@@ -212,10 +212,12 @@ glfs_t *
svs_get_latest_snapshot (xlator_t *this);
glfs_t *
-svs_initialise_snapshot_volume (xlator_t *this, const char *name);
+svs_initialise_snapshot_volume (xlator_t *this, const char *name,
+ int32_t *op_errno);
glfs_t *
-__svs_initialise_snapshot_volume (xlator_t *this, const char *name);
+__svs_initialise_snapshot_volume (xlator_t *this, const char *name,
+ int32_t *op_errno);
snap_dirent_t *
__svs_get_snap_dirent (xlator_t *this, const char *name);