Skip to content

Commit

Permalink
test: ceph_ll_lookup corner case
Browse files Browse the repository at this point in the history
Using the root inode as parent and want=CEPH_STATX_INO call
ceph_ll_lookup("/"). This currently causes the MDS to crash.

Signed-off-by: David Disseldorp <ddiss@suse.de>
  • Loading branch information
ddiss committed Jan 13, 2020
1 parent 24aa280 commit 67938a7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/libcephfs/test.cc
Expand Up @@ -2273,3 +2273,29 @@ TEST(LibCephFS, SnapXattrs) {

ceph_shutdown(cmount);
}

TEST(LibCephFS, RootLookupStat) {
struct ceph_mount_info *cmount;
ASSERT_EQ(ceph_create(&cmount, NULL), 0);
ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
ASSERT_EQ(0, ceph_conf_parse_env(cmount, NULL));
ASSERT_EQ(ceph_mount(cmount, NULL), 0);

Inode *root, *diri;
ASSERT_EQ(ceph_ll_lookup_root(cmount, &root), 0);

struct ceph_statx stx;
UserPerm *perms = ceph_mount_perms(cmount);

int mypid = getpid();
char dirname[PATH_MAX];

sprintf(dirname, "root-rel-dir-%u", mypid);
ASSERT_EQ(ceph_ll_mkdir(cmount, root, dirname, 0777,
&diri, &stx, 0, 0, perms), 0);

ASSERT_EQ(ceph_ll_lookup(cmount, root, "/", &diri, &stx,
CEPH_STATX_INO, 0, perms), 0);

ceph_shutdown(cmount);
}

0 comments on commit 67938a7

Please sign in to comment.