summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-12-10 20:13:22 +0530
committerDan Lambright <dlambrig@redhat.com>2016-02-22 06:53:07 -0800
commit40902503da073bb106ba0eef7788692f0cfcfc20 (patch)
tree21bf39493246190ca070b177dd65693b6422b305 /xlators/storage/posix
parent28f561b1855d118202de3a6d454d688c1ccb9e6e (diff)
tier:delete the linkfile if data file creation fails
If we are creating data file in a hot subvolume then we will create a linkfile in cold subvolume. Linkfile creation happens first. If linkfile creation was successful and data file creation failed, then linkfile in cold subvolume will become stale This patch will delete the linkfile as well, if data file creation fails Also this code duplicates dht_create to make tier_create backport of> >Change-Id: I377a90dad47f288e9576c7323b23cf694a91a7a3 >BUG: 1290677 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/12948 >Reviewed-by: N Balachandran <nbalacha@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Raghavendra G <rgowdapp@redhat.com> >Reviewed-by: Dan Lambright <dlambrig@redhat.com> >Tested-by: Dan Lambright <dlambrig@redhat.com> Change-Id: I3689e8ee387fb6731b4b3a7fe8f8190143482eaa BUG: 1295359 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13161 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-messages.h2
-rw-r--r--xlators/storage/posix/src/posix.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h
index 9f267dfe0d9..961a706cc36 100644
--- a/xlators/storage/posix/src/posix-messages.h
+++ b/xlators/storage/posix/src/posix-messages.h
@@ -45,7 +45,7 @@
*/
#define POSIX_COMP_BASE GLFS_MSGID_COMP_POSIX
-#define GLFS_NUM_MESSAGES 104
+#define GLFS_NUM_MESSAGES 105
#define GLFS_MSGID_END (POSIX_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_x POSIX_COMP_BASE, "Invalid: Start of messages"
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index a539410bbc2..433b5a41dc8 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1691,6 +1691,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
ssize_t xattr_size = -1;
int32_t is_dht_linkto_file = 0;
dict_t *unwind_dict = NULL;
+ void *uuid = NULL;
+ char uuid_str[GF_UUID_BUF_SIZE] = {0};
+ char gfid_str[GF_UUID_BUF_SIZE] = {0};
DECLARE_OLD_FS_ID_VAR;
@@ -1717,6 +1720,20 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
priv = this->private;
+ op_ret = dict_get_ptr (xdata, TIER_LINKFILE_GFID, &uuid);
+
+ if (!op_ret && gf_uuid_compare (uuid, stbuf.ia_gfid)) {
+ op_errno = ENOENT;
+ op_ret = -1;
+ gf_uuid_unparse (uuid, uuid_str);
+ gf_uuid_unparse (stbuf.ia_gfid, gfid_str);
+ gf_msg_debug (this->name, op_errno, "Mismatch in gfid for path "
+ "%s. Aborting the unlink. loc->gfid = %s, "
+ "stbuf->ia_gfid = %s", real_path,
+ uuid_str, gfid_str);
+ goto out;
+ }
+
op_ret = dict_get_int32 (xdata, DHT_SKIP_OPEN_FD_UNLINK,
&check_open_fd);