Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephfs-journal-tool: get and check layout info during dump/undump #22211

Merged
merged 1 commit into from Jul 15, 2018

Conversation

guzhongyan
Copy link
Contributor

when cephfs-journal-tool import journal, it uses default layout
to get object_size, this is wrong. Because default objetct_size
can be changed by Config option change mds_log_segment_size when
cluster initialized.

The fix is save the layout info to header during journal export,
When improt journal, first try to get layout from cluster, if failed,
then get layout info from dumped journal file, if still failed, set
layout to default.

Signed-off-by: Gu Zhongyan guzhongyan@360.cn
Signed-off-by: yupeng chen chenyupeng-it@360.cn

@guzhongyan
Copy link
Contributor Author

@jcsp @batrick , please take a look?

@tchaikov tchaikov requested a review from batrick May 29, 2018 05:15
@tchaikov tchaikov added cephfs Ceph File System tools labels May 29, 2018
@batrick batrick requested a review from ukernel June 6, 2018 23:28
@batrick
Copy link
Member

batrick commented Jun 22, 2018

retest this please

@batrick
Copy link
Member

batrick commented Jun 22, 2018

Please create a tracker issue so that this issue can be tracked for backporting.

Then, please annotate the commit which fixes/resolves a Ceph tracker issue with:

Fixes: http://tracker.ceph.com/issues/...

This is essential when examining the history of the repository (this commit fixes what) and helps merge scripts identify issues that have been resolved by a merge.

@guzhongyan
Copy link
Contributor Author

@batrick tracker issue created. commit updated. please review.

snprintf(buf, HEADER_LEN, "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n\
length %llu (0x%llx)\n write_pos %llu (0x%llx)\n format %llu\n\
trimmed_pos %llu (0x%llx)\n stripe_unit %lu (0x%lx)\n stripe_count %lu (0x%lx)\n\
object_size %lu (0x%lx)\n fsid %s\n%c",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsid left in from other PR. This causes a seg-fault:

(gdb) bt
#0  0x00007f4e6a3cb269 in raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/pt-raise.c:35
#1  0x000055b7f691d9b3 in reraise_fatal (signum=11) at /build/ceph-14.0.0-787-g8f48616/src/global/signal_handler.cc:80
#2  handle_fatal_signal (signum=11) at /build/ceph-14.0.0-787-g8f48616/src/global/signal_handler.cc:290
#3  <signal handler called>
#4  0x00007f4e69929cc0 in _IO_vfprintf_internal (s=s@entry=0x7fffd3b87d50, format=<optimized out>, 
    format@entry=0x55b7f6946008 "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n    write_pos %llu (0x%llx)\n    format %llu\n    trimmed_pos %llu (0x%llx)\n    stripe_unit %lu (0x%lx)\n    stripe_count %"..., ap=ap@entry=0x7fffd3b87ec8) at vfprintf.c:1632
#5  0x00007f4e699f1896 in ___vsnprintf_chk (
    s=0x7fffd3b88770 "Ceph mds0 journal dump\n start offset 4194304 (0x400000)\n       length 31179 (0x79cb)\n    write_pos 4221504 (0x406a40)\n    format 1\n    trimmed_pos 4194304 (0x400000)\n    stripe_unit 4194304 (0x400000)"..., maxlen=<optimized out>, flags=1, slen=<optimized out>, 
    format=0x55b7f6946008 "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n    write_pos %llu (0x%llx)\n    format %llu\n    trimmed_pos %llu (0x%llx)\n    stripe_unit %lu (0x%lx)\n    stripe_count %"..., args=args@entry=0x7fffd3b87ec8) at vsnprintf_chk.c:63
#6  0x00007f4e699f17f8 in ___snprintf_chk (
    s=s@entry=0x7fffd3b88770 "Ceph mds0 journal dump\n start offset 4194304 (0x400000)\n       length 31179 (0x79cb)\n    write_pos 4221504 (0x406a40)\n    format 1\n    trimmed_pos 4194304 (0x400000)\n    stripe_unit 4194304 (0x400000)"..., maxlen=maxlen@entry=4096, flags=flags@entry=1, slen=slen@entry=4096, 
    format=format@entry=0x55b7f6946008 "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n    write_pos %llu (0x%llx)\n    format %llu\n    trimmed_pos %llu (0x%llx)\n    stripe_unit %lu (0x%lx)\n    stripe_count %"...) at snprintf_chk.c:34
#7  0x000055b7f65ddac0 in snprintf (
    __fmt=0x55b7f6946008 "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n       length %llu (0x%llx)\n    write_pos %llu (0x%llx)\n    format %llu\n    trimmed_pos %llu (0x%llx)\n    stripe_unit %lu (0x%lx)\n    stripe_count %"..., __n=4096, 
    __s=0x7fffd3b88770 "Ceph mds0 journal dump\n start offset 4194304 (0x400000)\n       length 31179 (0x79cb)\n    write_pos 4221504 (0x406a40)\n    format 1\n    trimmed_pos 4194304 (0x400000)\n    stripe_unit 4194304 (0x400000)"...) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:65
#8  Dumper::dump (this=this@entry=0x7fffd3b89980, dump_file=0x55b7f8934180 "/tmp/journal.bin") at /build/ceph-14.0.0-787-g8f48616/src/tools/cephfs/Dumper.cc:111
#9  0x000055b7f65c1c25 in JournalTool::journal_export (this=this@entry=0x7fffd3b89e40, path="/tmp/journal.bin", import=<optimized out>) at /build/ceph-14.0.0-787-g8f48616/src/tools/cephfs/JournalTool.cc:589
#10 0x000055b7f65c226b in JournalTool::main_journal (this=this@entry=0x7fffd3b89e40, argv=std::vector of length 2, capacity 3 = {...}) at /build/ceph-14.0.0-787-g8f48616/src/tools/cephfs/JournalTool.cc:207
#11 0x000055b7f65ba522 in JournalTool::main (this=0x7fffd3b89e40, argv=std::vector of length 2, capacity 3 = {...}) at /build/ceph-14.0.0-787-g8f48616/src/tools/cephfs/JournalTool.cc:168
#12 0x000055b7f65b97b6 in main (argc=<optimized out>, argv=<optimized out>) at /build/ceph-14.0.0-787-g8f48616/src/tools/cephfs/cephfs-journal-tool.cc:51

From: http://pulpito.ceph.com/pdonnell-2018-06-23_02:11:08-fs-wip-pdonnell-testing-20180622.235254-testing-basic-smithi/2692237/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batrick should I combine this pr with the fsid-introduced pr as a single pr to avoid the isssue. they touched the same file same function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can wait until the fsid PR goes in.

Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase.

when cephfs-journal-tool import journal, it uses default layout
to get object_size, this is wrong. Because default objetct_size
can be changed by Config option change mds_log_segment_size when
cluster initialized.

The fix is save the layout info to header during journal export,
When improt journal, first try to get layout from cluster, if failed,
then get layout info from dumped journal file, if still failed, set
layout to default.

Fixes: http://tracker.ceph.com/issues/24644

Signed-off-by: Gu Zhongyan <guzhongyan@360.cn>
Signed-off-by: yupeng chen chenyupeng-it@360.cn
@guzhongyan
Copy link
Contributor Author

@batrick , rebased, please take a look.

wjwithagen pushed a commit to wjwithagen/ceph that referenced this pull request Jul 15, 2018
* refs/pull/22211/head:
	cephfs-journal-tool: get and check layout info during dump/undump

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Zheng Yan <zyan@redhat.com>
@batrick batrick merged commit 989ecf2 into ceph:master Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants