mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
ceph_test_libcephfs: shutdown without closing file/dir
Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
8fc1b1b095
commit
9e3441733c
@ -1321,3 +1321,26 @@ TEST(LibCephFS, GetOsdAddr) {
|
||||
|
||||
ceph_shutdown(cmount);
|
||||
}
|
||||
|
||||
TEST(LibCephFS, OpenNoClose) {
|
||||
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, "/"), 0);
|
||||
|
||||
pid_t mypid = getpid();
|
||||
char str_buf[256];
|
||||
sprintf(str_buf, "open_no_close_dir%d", mypid);
|
||||
ASSERT_EQ(0, ceph_mkdirs(cmount, str_buf, 0777));
|
||||
|
||||
struct ceph_dir_result *ls_dir = NULL;
|
||||
ASSERT_EQ(ceph_opendir(cmount, str_buf, &ls_dir), 0);
|
||||
|
||||
sprintf(str_buf, "open_no_close_file%d", mypid);
|
||||
int fd = ceph_open(cmount, str_buf, O_RDONLY|O_CREAT, 0666);
|
||||
ASSERT_LT(0, fd);
|
||||
|
||||
// shutdown should force close opened file/dir
|
||||
ceph_shutdown(cmount);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user