summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2019-01-21 15:15:51 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2019-02-04 14:51:06 +0000
commit05ba01297657deef881aa9cd2770bbe760abf090 (patch)
tree00379e39f284f88e903b67a869ee174084166647 /xlators
parentf2d366835652b2911c96155f7c429ddf485c1a89 (diff)
cluster/dht: Delete invalid linkto files in rmdir
rm -rf <dir> fails on dirs which contain linkto files that point to themselves because dht incorrectly thought that they were cached files after looking them up. The fix now treats them as invalid linkto files and deletes them. Change-Id: I376c72a5309714ee339c74485e02cfb4e29be643 fixes: bz#1671611 Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 16a4786c12a..583875bcbb4 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -9944,7 +9944,10 @@ dht_rmdir_is_subvol_empty(call_frame_t *frame, xlator_t *this,
lookup_local->loc.path, src->name, gfid);
subvol = dht_linkfile_subvol(this, NULL, &trav->d_stat, trav->dict);
- if (!subvol) {
+ if (!subvol || (subvol == src)) {
+ /* we need to delete the linkto file if it does not have a
+ * valid subvol or it points to itself.
+ */
gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_INVALID_LINKFILE,
"Linkfile does not have link subvolume. "
"path = %s, gfid = %s",