From cc8bf4bb291870e3d98d25f1e2d08856be889d8d Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Sun, 9 Jul 2017 23:16:39 -0400 Subject: 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=, 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=, this=, op_ret=, op_errno=, entries=0x7f1474731c00, xdata=0x0) at marker.c:3055 8 0x00007f14848b9cd9 in default_readdirp_cbk ( frame=frame@entry=0x7f1482315b30, cookie=, this=, 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=, this=, op_ret=6904, op_errno=0, entries=0x7f1474731c00, xdata=0x0) at posix.c:2700 10 0x00007f1476e26819 in posix_readdirp (frame=0x7f1482315f54, this=, fd=, size=, off=, dict=) 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 Reviewed-on: https://review.gluster.org/17730 Tested-by: Raghavendra G Reviewed-by: Raghavendra G CentOS-regression: Gluster Build System Smoke: Gluster Build System --- xlators/features/marker/src/marker-quota.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'xlators/features/marker') 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) -- cgit