summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPranith Kumar Karampuri <pranith.karampuri@phonepe.com>2021-02-03 21:32:45 +0530
committerGitHub <noreply@github.com>2021-02-03 21:32:45 +0530
commit449ef110446891eec44e329dc30112225872bccd (patch)
treea27aae300bbdb404c397bf5f5d49cb84ae7dd341 /xlators
parent8bc83c331b7dd159f5eb56e0ab5362450d473364 (diff)
downloadglusterfs-449ef110446891eec44e329dc30112225872bccd.tar.gz
glusterfs-449ef110446891eec44e329dc30112225872bccd.tar.xz
glusterfs-449ef110446891eec44e329dc30112225872bccd.zip
cluster/dht: Allow fix-layout only on directories (#2109)
Problem: fix-layout operation assumes that the directory passed is directory i.e. layout->cnt == conf->subvolume_cnt. This will lead to a crash when fix-layout is attempted on a file. Fix: Disallow fix-layout on files fixes: #2107 Change-Id: I2116b8773059f67e3260e9207e20eab3de711417 Signed-off-by: Pranith Kumar K <pranith.karampuri@phonepe.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index b16ef8fe6e..d27670d796 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -5907,6 +5907,10 @@ dht_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr,
tmp = dict_get(xattr, GF_XATTR_FIX_LAYOUT_KEY);
if (tmp) {
+ if (!IA_ISDIR(loc->inode->ia_type)) {
+ op_errno = ENOTSUP;
+ goto err;
+ }
ret = dict_get_uint32(xattr, "new-commit-hash", &new_hash);
if (ret == 0) {
gf_msg_debug(this->name, 0,