summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/marker/src/marker-quota.c18
-rw-r--r--xlators/features/quota/src/quota.c10
2 files changed, 26 insertions, 2 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 902b8e5c272..b4c3eb395bd 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -214,6 +214,15 @@ mq_build_ancestry (xlator_t *this, loc_t *loc)
list_for_each_entry (entry, &entries.list, list) {
if (__is_root_gfid (entry->inode->gfid)) {
+ /* The list contains a sub-list for each possible path
+ * to the target inode. Each sub-list starts with the
+ * root entry of the tree and is followed by the child
+ * entries for a particular path to the target entry.
+ * The root entry is an implied sub-list delimiter,
+ * as it denotes we have started processing a new path.
+ * Reset the parent pointer and continue
+ */
+
tmp_parent = NULL;
} else {
linked_inode = inode_link (entry->inode, tmp_parent,
@@ -240,7 +249,14 @@ mq_build_ancestry (xlator_t *this, loc_t *loc)
goto out;
}
- tmp_parent = entry->inode;
+ /* For non-directory, posix_get_ancestry_non_directory returns
+ * all hard-links that are represented by nodes adjacent to
+ * each other in the dentry-list.
+ * (Unlike the directory case where adjacent nodes either have
+ * a parent/child relationship or belong to different paths).
+ */
+ if (entry->inode->ia_type == IA_IFDIR)
+ tmp_parent = entry->inode;
}
if (loc->parent)
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 7a84aeb9aba..a3078453f78 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -801,7 +801,15 @@ quota_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
quota_fill_inodectx (this, entry->inode, entry->dict,
&loc, &entry->d_stat, &op_errno);
- tmp_parent = entry->inode;
+ /* For non-directory, posix_get_ancestry_non_directory
+ * returns all hard-links that are represented by nodes
+ * adjacent to each other in the dentry-list.
+ * (Unlike the directory case where adjacent nodes
+ * either have a parent/child relationship or belong to
+ * different paths).
+ */
+ if (entry->inode->ia_type == IA_IFDIR)
+ tmp_parent = entry->inode;
loc_wipe (&loc);
}