path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
authorSakshi Bansal <>2018-01-22 14:38:17 +0530
committerRaghavendra G <>2018-01-24 05:39:44 +0000
commit78868033bc208bdb681266d0129e66f5627295a2 (patch)
tree89695fbabe3cc077669b23934aac24c3f457ef3c /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent5cbe21b1ddf6eae4782afa33ce841fc4aa195974 (diff)
dentry fop serializer: added new server side xlator for dentry fop serialization
Problems addressed by this xlator : [1]. To prevent race between parallel mkdir,mkdir and lookup etc. Fops like mkdir/create, lookup, rename, unlink, link that happen on a particular dentry must be serialized to ensure atomicity. Another possible case can be a fresh lookup to find existance of a path whose gfid is not set yet. Further, storage/posix employs a ctime based heuristic 'is_fresh_file' (interval time is less than 1 second of current time) to check fresh-ness of file. With serialization of these two fops (lookup & mkdir), we eliminate the race altogether. [2]. Staleness of dentries This causes exponential increase in traversal time for any inode in the subtree of the directory pointed by stale dentry. Cause : Stale dentry is created because of following two operations: a. dentry creation due to inode_link, done during operations like lookup, mkdir, create, mknod, symlink, create and b. dentry unlinking due to various operations like rmdir, rename, unlink. The reason is __inode_link uses __is_dentry_cyclic, which explores all possible path to avoid cyclic link formation during inode linkage. __is_dentry_cyclic explores stale-dentry(ies) and its all ancestors which is increases traversing time exponentially. Implementation : To acheive this all fops on dentry must take entry locks before they proceed, once they have acquired locks, they perform the fop and then release the lock. Some documentation from email conversation: [1] [2] With this patch, the feature is optional, enable it by running: `gluster volume set $volname features.sdfs enable` Also the feature is tested for a month without issues in the experiemental branch for all the regression. Change-Id: I6e80ba3cabfa6facd5dda63bd482b9bf18b6b79b Fixes: #397 BUG: 1304962 Signed-off-by: Sakshi Bansal <> Signed-off-by: Amar Tumballi <> Signed-off-by: Sunny Kumar <>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
1 files changed, 26 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 6a02da1..235a4bd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2024,6 +2024,31 @@ out:
return ret;
+static int
+brick_graph_add_sdfs (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
+ dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
+ xlator_t *xl = NULL;
+ int ret = -1;
+ if (!graph || !volinfo)
+ goto out;
+ if (!dict_get_str_boolean (set_dict, "features.sdfs", 0)) {
+ /* update only if option is enabled */
+ ret = 0;
+ goto out;
+ }
+ xl = volgen_graph_add (graph, "features/sdfs", volinfo->volname);
+ if (!xl)
+ goto out;
+ ret = 0;
+ return ret;
xlator_t *
add_one_peer (volgen_graph_t *graph, glusterd_brickinfo_t *peer,
char *volname, uint16_t index)
@@ -2616,6 +2641,7 @@ static volgen_brick_xlator_t server_graph_table[] = {
{brick_graph_add_server, NULL},
{brick_graph_add_decompounder, "decompounder"},
{brick_graph_add_io_stats, "NULL"},
+ {brick_graph_add_sdfs, "sdfs"},
{brick_graph_add_cdc, NULL},
{brick_graph_add_quota, "quota"},
{brick_graph_add_index, "index"},