diff options
author | Ravishankar N <ravishankar@redhat.com> | 2021-01-05 20:31:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 20:31:46 +0530 |
commit | 9b32fe33c02fe84dcc065b45d3535799737fb93a (patch) | |
tree | d10cbcf5342cbc939f6141acb65383d446e38816 | |
parent | 02f669d744f3287566c7bad2b1d3a054ff26acfc (diff) | |
download | glusterfs-9b32fe33c02fe84dcc065b45d3535799737fb93a.tar.gz glusterfs-9b32fe33c02fe84dcc065b45d3535799737fb93a.tar.xz glusterfs-9b32fe33c02fe84dcc065b45d3535799737fb93a.zip |
dht: handle DHT_SUBVOL_STATUS_KEY in dht_pt_getxattr (#1934) (#1969)
In non distribute volumes (plain replicate, ec), DHT uses pass-through
FOPs (dht_pt_getxattr) instead of the usual FOPS (dht_getxattr). The
pass through FOP was not handling the DHT_SUBVOL_STATUS_KEY virtual
xattr because of which geo-rep session was going into a faulty state.
Fixing it now.
updates: #1925
Change-Id: I766b5b5c047c954a9957ab78aca680eedef1ff1f
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 8c326b96c2..2cc3a0d200 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -11337,9 +11337,33 @@ int dht_pt_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key, dict_t *xdata) { + int op_errno = -1; + dht_local_t *local = NULL; + + VALIDATE_OR_GOTO(frame, err); + VALIDATE_OR_GOTO(this, err); + VALIDATE_OR_GOTO(loc, err); + VALIDATE_OR_GOTO(loc->inode, err); + VALIDATE_OR_GOTO(this->private, err); + + local = dht_local_init(frame, loc, NULL, GF_FOP_GETXATTR); + if (!local) { + op_errno = ENOMEM; + goto err; + } + + if (key && + strncmp(key, DHT_SUBVOL_STATUS_KEY, SLEN(DHT_SUBVOL_STATUS_KEY)) == 0) { + dht_vgetxattr_subvol_status(frame, this, key); + return 0; + } + STACK_WIND(frame, dht_pt_getxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, loc, key, xdata); return 0; +err: + DHT_STACK_UNWIND(getxattr, frame, -1, op_errno, NULL, NULL); + return 0; } static int |