summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src
diff options
context:
space:
mode:
authorKinglong Mee <mijinlong@open-fs.com>2017-07-09 23:16:39 -0400
committerRaghavendra G <rgowdapp@redhat.com>2017-07-17 04:59:30 +0000
commitcc8bf4bb291870e3d98d25f1e2d08856be889d8d (patch)
tree63c9c61aa26926e455480809d33d4654a8a91681 /xlators/features/marker/src
parent6ed8518cfa352f53b84a511f3618b50ba4a42853 (diff)
quota: fix a crash by using bad regfile inode as parent
0 0x00007f1482f1f1d7 in raise () from /lib64/libc.so.6 1 0x00007f1482f208c8 in abort () from /lib64/libc.so.6 2 0x00007f1482f18146 in __assert_fail_base () from /lib64/libc.so.6 3 0x00007f1482f181f2 in __assert_fail () from /lib64/libc.so.6 4 0x00007f148484986a in __inode_link (inode=inode@entry=0x7f14742404d4, parent=parent@entry=0x7f14742404d4, name=name@entry=0x7f1460001c48 "testfile5308", iatt=iatt@entry=0x7f1460001bc8) at inode.c:954 5 0x00007f1484849969 in inode_link (inode=0x7f14742404d4, parent=parent@entry=0x7f14742404d4, name=name@entry=0x7f1460001c48 "testfile5308", iatt=iatt@entry=0x7f1460001bc8) at inode.c:1060 6 0x00007f147591b895 in quota_build_ancestry_cbk ( frame=frame@entry=0x7f1482315e80, cookie=<optimized out>, this=0x7f147000e910, op_ret=op_ret@entry=6904, op_errno=op_errno@entry=0, entries=entries@entry=0x7f1474731c00, xdata=xdata@entry=0x0) at quota.c:779 7 0x00007f1475b2f505 in marker_build_ancestry_cbk (frame=0x7f1482315988, cookie=<optimized out>, this=<optimized out>, op_ret=<optimized out>, op_errno=<optimized out>, entries=0x7f1474731c00, xdata=0x0) at marker.c:3055 8 0x00007f14848b9cd9 in default_readdirp_cbk ( frame=frame@entry=0x7f1482315b30, cookie=<optimized out>, this=<optimized out>, op_ret=op_ret@entry=6904, op_errno=op_errno@entry=0, entries=entries@entry=0x7f1474731c00, xdata=xdata@entry=0x0) at defaults.c:1403 9 0x00007f1475f68132 in pl_readdirp_cbk (frame=0x7f1482315dac, cookie=<optimized out>, this=<optimized out>, op_ret=6904, op_errno=0, entries=0x7f1474731c00, xdata=0x0) at posix.c:2700 10 0x00007f1476e26819 in posix_readdirp (frame=0x7f1482315f54, this=<optimized out>, fd=<optimized out>, size=<optimized out>, off=<optimized out>, dict=<optimized out>) at posix.c:6282 11 0x00007f1475f6599a in pl_readdirp (frame=0x7f1482315dac, this=0x7f147000a200, fd=0x7f1484b5106c, size=0, offset=0, xdata=0x7f1481ab4f34) at posix.c:2711 12 0x00007f14848ce954 in default_readdirp_resume (frame=0x7f1482315b30, this=0x7f147000b690, fd=0x7f1484b5106c, size=0, off=0, xdata=0x7f1481ab4f34) at defaults.c:2019 13 0x00007f148485c92d in call_resume (stub=0x7f1481b65710) at call-stub.c:2508 14 0x00007f1475d54743 in iot_worker (data=0x7f147004e7d0) at io-threads.c:210 15 0x00007f148369cdc5 in start_thread () from /lib64/libpthread.so.0 16 0x00007f1482fe173d in clone () from /lib64/libc.so.6 Change-Id: I740dc691e7be1bc2a9ae3a0cb14bbf566ea77bc5 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com> Reviewed-on: https://review.gluster.org/17730 Tested-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features/marker/src')
-rw-r--r--xlators/features/marker/src/marker-quota.c18
1 files changed, 17 insertions, 1 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)