From 75205f901c06f39fdd41ebd13303e0a70a460041 Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Tue, 3 Dec 2019 10:29:37 +0530 Subject: cluster/dht: Add comments to code Change-Id: Ieb7531af19ae89fb8a8387e81663c7f157b10c02 Updates: bz#1765421 Signed-off-by: N Balachandran --- xlators/cluster/dht/src/dht-common.c | 2 +- xlators/cluster/dht/src/dht-rebalance.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 478cb48009e..be13558fe80 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1029,7 +1029,7 @@ dht_discover_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, if (local->xattr == NULL) { local->xattr = dict_ref(xattr); } else { - /* Don't aggregate for files. See BZ#1484113 */ + /* Don't aggregate for files. See BZ#1484709 */ if (is_dir) dht_aggregate_xattr(local->xattr, xattr); } diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index d4e639db704..0d68ed53e08 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1579,7 +1579,8 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, } /* If defrag is NULL, it should be assumed that migration is triggered - * from client */ + * from client using the trusted.distribute.migrate-data virtual xattr + */ defrag = conf->defrag; /* migration of files from clients is restricted to non-tiered clients @@ -1634,6 +1635,10 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, loc->path); } + /* The file is locked to prevent a rename during a migration. Renames + * and migrations on the file at the same time can lead to data loss. + */ + ret = dht_build_parent_loc(this, &parent_loc, loc, fop_errno); if (ret < 0) { ret = -1; @@ -3920,6 +3925,13 @@ gf_defrag_fix_layout(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, INIT_LIST_HEAD(&entries.list); } + /* A directory layout is fixed only after its subdirs are healed to + * any newly added bricks. If the layout is fixed before subdirs are + * healed, the newly added brick will get a non-null layout. + * Any subdirs which hash to that layout will no longer show up + * in a directory listing until they are healed. + */ + ret = syncop_setxattr(this, loc, fix_layout, 0, NULL, NULL); if (ret) { if (-ret == ENOENT || -ret == ESTALE) { -- cgit