pmem / pmdk

Persistent Memory Development Kit
https://pmem.io
Other
1.34k stars 510 forks source link

libpmemblk pmemlog example code manpage.c does not work but libpmem manpage example works #4691

Closed gwnet closed 3 years ago

gwnet commented 4 years ago

ISSUE:

Environment Information

Please provide a reproduction of the bug:

pmemlog example has the same issue.

murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemblk # ./manpage /mnt/wayne/testblk: No such file or directory murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemblk #

pmem1 259:45 0 124G 0 disk /mnt/wayne admin@murray-rust:/mnt/wayne> ls -l total 1048580 -rw-r--r-- 1 root root 4096 Mar 28 03:38 test0 -rwx------ 1 root root 1073741824 Mar 28 03:00 test1 drwxr-xr-x 2 root root 285 Mar 28 02:57 test2 admin@murray-rust:/mnt/wayne> mount | grep dax /dev/pmem1 on /mnt/wayne type xfs (rw,relatime,attr2,dax,inode64,noquota)

How often bug is revealed: (always, often, rare):

Actual behavior:

Expected behavior:

Details

Additional information about Priority and Help Requested:

Are you willing to submit a pull request with a proposed change? (Yes, No)

Requested priority: (Showstopper, High, Medium, Low)

gwnet commented 4 years ago

libpmempool has the same thing. I can run pmemkv successfully on this machine.

==== murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmempool # ./manpage pmempool_check_init: No such file or directory

gwnet commented 4 years ago

murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemobj/array # ./array /mnt/wayne/testfile alloc test1 10 TOID failed to create pool

gwnet commented 4 years ago

==bad strace result=== munmap(0x7f38fc9a8000, 4096) = 0 mprotect(0x7f38f9800000, 4096, PROT_READ|PROT_WRITE) = 0 msync(0x7f38f9800000, 4096, MS_SYNC) = 0 munmap(0x7f38f9800000, 8388608) = 0 close(3) = 0 access("/mnt/wayne/testfile", F_OK) = 0 stat("/mnt/wayne/testfile", {st_mode=S_IFREG, st_size=8388608, ...}) = 0 unlink("/mnt/wayne/testfile") = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f38fc9a8000 write(1, "failed to create pool\n", 22failed to create pool ) = 22 exit_group(1) = ? +++ exited with 1 +++ murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemobj/array #

gwnet commented 4 years ago

===good strace result from libpmem== close(4) = 0 fchdir(3) = 0 close(3) = 0 access("/mnt/wayne/test0", F_OK) = 0 stat("/mnt/wayne/test0", {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 open("/mnt/wayne/test0", O_RDWR|O_CREAT, 0666) = 3 ftruncate(3, 4096) = 0 fallocate(3, 0, 0, 4096) = 0 mmap(NULL, 2101248, PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efc4e940000 munmap(0x7efc4e940000, 2101248) = 0 mmap(0x7efc4ea00000, 4096, PROT_READ|PROTWRITE, 0x3 /* MAP??? */|0x80000, 3, 0) = 0x7efc4ea00000 close(3) = 0 munmap(0x7efc4ea00000, 4096) = 0 exit_group(0) = ? +++ exited with 0 +++

gwnet commented 4 years ago

==full debug log for libpmemblk== murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemblk # PMEMBLK_LOG_LEVEL=4 ./manpage

: <1> [out.c:236 out_init] pid 13456: program: /tmp/wayne/pmem/pmdk/src/examples/libpmemblk/manpage : <1> [out.c:238 out_init] libpmemblk version 1.1 : <1> [out.c:242 out_init] src version: 1.8 : <1> [out.c:250 out_init] compiled with support for Valgrind pmemcheck : <1> [out.c:255 out_init] compiled with support for Valgrind helgrind : <1> [out.c:260 out_init] compiled with support for Valgrind memcheck : <1> [out.c:265 out_init] compiled with support for Valgrind drd : <1> [out.c:270 out_init] compiled with support for shutdown state : <1> [out.c:275 out_init] compiled with libndctl 63+ : <3> [mmap.c:67 util_mmap_init] : <3> [libpmemblk.c:118 libpmemblk_init] : <3> [blk.c:417 pmemblk_createU] path /mnt/wayne/testblk bsize 1024 poolsize 1073741824 mode 666 : <3> [set.c:3353 util_pool_create] setp 0x7ffc7076fe90 path /mnt/wayne/testblk poolsize 1073741824 minsize 16785408 minpartsize 2097152 attr 0x7ffc7076fe20 nlanes (nil) can_have_rep 0 : <3> [set.c:3113 util_pool_create_uuids] setp 0x7ffc7076fe90 path /mnt/wayne/testblk poolsize 1073741824 minsize 16785408 minpartsize 2097152 pattr 0x7ffc7076fe20 nlanes (nil) can_have_rep 0 remote 0 : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [set.c:2123 util_poolset_create_set] setp 0x7ffc7076fe90 path /mnt/wayne/testblk poolsize 1073741824 minsize 16785408 : <3> [file.c:232 util_file_get_type] path "/mnt/wayne/testblk" : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [set.c:1702 util_poolset_single] path /mnt/wayne/testblk filesize 1073741824 create 1 : <3> [file.c:232 util_file_get_type] path "/mnt/wayne/testblk" : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [badblock.c:140 badblocks_check_poolset] set 0x25b70a0 create 1 : <3> [set.c:4244 util_poolset_foreach_part_struct] set 0x25b70a0 callback 0x7f5cbb721adf arg 0x7ffc7076fc40 : <3> [badblock.c:93 badblocks_check_file_cb] part_file 0x7ffc7076fbe0 arg 0x7ffc7076fc40 : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [set.c:2008 util_poolset_files_local] set 0x25b70a0 minpartsize 2097152 create 1 : <3> [set.c:1780 util_part_open] part 0x25b7178 minsize 2097152 create 1 : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [file.c:532 util_file_create] path "/mnt/wayne/testblk" size 1073741824 minsize 2097152 : <3> [set.c:2619 util_replica_map_local] set 0x25b70a0 repidx 0 flags 1 : <3> [mmap_posix.c:153 util_map_hint] len 1073741824 req_align 0 : <4> [mmap_posix.c:176 util_map_hint] system choice 0x7f5c79071000 : <4> [mmap_posix.c:181 util_map_hint] hint 0x7f5c79200000 : <3> [set.c:440 util_map_part] part 0x25b7178 addr 0x7f5c79200000 size 1073741824 offset 0 flags 1 : <4> [mmap_posix.c:210 util_map_sync] mmap with MAP_SYNC succeeded : <3> [set.c:1130 util_replica_check_map_sync] set 0x25b70a0 repidx 0 : <3> [set.c:2736 util_replica_map_local] replica #0 addr 0x7f5c79200000 : <3> [set.c:2806 util_replica_create_local] set 0x25b70a0 repidx 0 flags 1 attr 0x7ffc7076fe20 : <3> [set.c:2762 util_replica_init_headers_local] set 0x25b70a0 repidx 0 flags 1 attr 0x7ffc7076fe20 : <3> [set.c:364 util_map_hdr] part 0x25b7178 flags 1 : <4> [mmap_posix.c:210 util_map_sync] mmap with MAP_SYNC succeeded : <3> [set.c:2233 util_header_create] set 0x25b70a0 repidx 0 partidx 0 attr 0x7ffc7076fe20 overwrite 0 : <3> [set.c:3642 util_pool_attr2hdr] hdr 0x7f5cbbb76000, attr 0x7ffc7076fe20 : <3> [shutdown_state.c:70 shutdown_state_init] sds 0x7f5cbbb76fb8 : <3> [shutdown_state.c:56 shutdown_state_checksum] sds 0x7f5cbbb76fb8 : <3> [os_deep_linux.c:170 os_part_deep_common] part 0x25b7130 part 0 addr 0x7f5cbbb76fb8 len 64 flush 1 : <3> [shutdown_state.c:88 shutdown_state_add_part] sds 0x7f5cbbb76fb8, path /mnt/wayne/testblk : <3> [os_dimm_ndctl.c:347 os_dimm_usc] path /mnt/wayne/testblk, uid 0x7ffc7076fa98 : <3> [os_dimm_ndctl.c:266 os_dimm_interleave_set] ctx 0x25bbbb0 stat 0x7ffc7076f9b0 : <3> [os_dimm_ndctl.c:177 os_dimm_region_namespace] ctx 0x25bbbb0 stat 0x7ffc7076f9b0 pregion 0x7ffc7076f968 pnamespace (nil) : <4> [file.c:174 util_stat_get_type] not a character device : <3> [os_dimm_ndctl.c:107 os_dimm_match_fsdax] st 0x7ffc7076f9b0 devname : <3> [os_dimm_ndctl.c:107 os_dimm_match_fsdax] st 0x7ffc7076f9b0 devname pmem1 : <4> [os_dimm_ndctl.c:158 os_dimm_match_fsdax] found matching device: /sys/block/pmem1/dev : <1> [os_dimm_ndctl.c:337 os_dimm_usc_dimm] Cannot read unsafe shutdown count. For more information please check https://github.com/pmem/issues/issues/1039 : <2> [shutdown_state.c:95 shutdown_state_add_part] cannot read unsafe shutdown count for /mnt/wayne/testblk : <2> [set.c:2777 util_replica_init_headers_local] header creation failed - part #0 : <4> [set.c:2789 util_replica_init_headers_local] error clean up : <4> [set.c:423 util_unmap_hdr] munmap: addr 0x7f5cbbb76000 size 4096 : <2> [set.c:2823 util_replica_create_local] replica #0 headers initialization failed : <2> [set.c:3314 util_pool_create_uuids] replica #0 creation failed : <3> [set.c:2885 util_replica_close] set 0x25b70a0 repidx 0 : <3> [mmap.c:204 util_range_rw] addr 0x7f5c79200000 len 4096 : <3> [set.c:4434 util_replica_deep_drain] addr 0x7f5c79200000 len 1073741824 set 0x25b70a0 replica_id 0 : <3> [set.c:4367 util_replica_deep_common] addr 0x7f5c79200000 len 1073741824 set 0x25b70a0 replica_id 0 flush 0 : <3> [os_deep_linux.c:170 os_part_deep_common] part 0x25b7130 part 0 addr 0x7f5c79200000 len 1073741824 flush 0 : <3> [shutdown_state.c:152 shutdown_state_clear_dirty] sds 0x7f5c79200fb8 : <3> [set.c:483 util_unmap_part] part 0x25b7178 : <4> [set.c:486 util_unmap_part] munmap: addr 0x7f5c79200000 size 1073741824 : <3> [set.c:629 util_poolset_close] set 0x25b70a0 del 1 : <3> [set.c:2885 util_replica_close] set 0x25b70a0 repidx 0 : <3> [set.c:483 util_unmap_part] part 0x25b7178 : <4> [set.c:579 util_replica_close_local] unlink /mnt/wayne/testblk : <3> [file.c:657 util_unlink] path "/mnt/wayne/testblk" : <3> [file.c:232 util_file_get_type] path "/mnt/wayne/testblk" : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <4> [file.c:174 util_stat_get_type] not a character device : <3> [set.c:521 util_poolset_free] set 0x25b70a0 : <2> [blk.c:444 pmemblk_createU] cannot create pool or pool set : <3> [blk.c:599 pmemblk_openU] path /mnt/wayne/testblk bsize 1024 : <3> [blk.c:531 blk_open_common] path /mnt/wayne/testblk bsize 1024 flags 0x0 : <3> [set.c:3940 util_pool_open] setp 0x7ffc7076fe70 path /mnt/wayne/testblk minpartsize 2097152 attr 0x7f5cbb74ba40 nlanes (nil) addr (nil) flags 0x0 : <3> [set.c:2123 util_poolset_create_set] setp 0x7ffc7076fe70 path /mnt/wayne/testblk poolsize 0 minsize 0 : <3> [file.c:232 util_file_get_type] path "/mnt/wayne/testblk" : <3> [file.c:140 util_file_exists] path "/mnt/wayne/testblk" : <3> [file.c:597 util_file_open] path "/mnt/wayne/testblk" size 0x7ffc7076fd38 minsize 0 flags 0 : <1> [file.c:607 util_file_open] open "/mnt/wayne/testblk": No such file or directory : <2> [set.c:3950 util_pool_open] cannot open pool set -- '/mnt/wayne/testblk' : <2> [blk.c:537 blk_open_common] cannot open pool or pool set /mnt/wayne/testblk: No such file or directory : <3> [libpmemblk.c:130 libpmemblk_fini] : <3> [mmap.c:101 util_mmap_fini]
gwnet commented 4 years ago

looks like this works, can you give me all the *_CONF for all the examples? murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmemblk # PMEMBLK_CONF="sds.at_create=0" ./manpage file holds 1044204 elements

gwnet commented 4 years ago

===only libpmempool sample does not work now, please guide murray-rust:/tmp/wayne/pmem/pmdk/src/examples/libpmempool # PMEMOBJ_CONF="sds.at_create=0" ./manpage pmempool_check_init: No such file or directory