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

mds: use the whole string as the snapshot long name #45192

Merged
merged 1 commit into from Dec 12, 2022

Conversation

lxbsz
Copy link
Member

@lxbsz lxbsz commented Feb 28, 2022

The length of encrypted the snapshot name will be longer than normal
name and we need the whole encrypted name in kclient to do the base64
decode.

The full string of the encrypted long name will be like _${ENCRPTED-NAME}_${INO}.

Signed-off-by: Xiubo Li xiubli@redhat.com

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@lxbsz lxbsz requested review from vshankar and a team February 28, 2022 10:13
@github-actions github-actions bot added the cephfs Ceph File System label Feb 28, 2022
@lxbsz lxbsz requested a review from jtlayton February 28, 2022 10:14
@lxbsz lxbsz force-pushed the snapshotlongname branch 2 times, most recently from 12bbe7c to 6a05384 Compare February 28, 2022 11:26
@ajarr
Copy link
Contributor

ajarr commented Feb 28, 2022

looks good!

Copy link
Contributor

@nmshelke nmshelke left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jtlayton jtlayton left a comment

Choose a reason for hiding this comment

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

Looks fine otherwise.

src/mds/snap.cc Outdated Show resolved Hide resolved
@lxbsz
Copy link
Member Author

lxbsz commented Mar 2, 2022

jenkins retest this please

@@ -84,9 +84,9 @@ std::string_view SnapInfo::get_long_name() const
if (long_name.empty() ||
long_name.compare(1, name.size(), name) ||
long_name.find_last_of("_") != name.size() + 1) {
char nm[80];
Copy link
Contributor

Choose a reason for hiding this comment

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

This puzzles me. Does this mean that creating a snapshot with a name length > 80 is currently broken? I guess that bad things can happen if I do an LSSNAP in the .snap directory that has one of these 'long names'.
Any idea why there was such a limitation? And how sure are we that this change won't break something else?

Copy link
Member Author

@lxbsz lxbsz Mar 9, 2022

Choose a reason for hiding this comment

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

This puzzles me. Does this mean that creating a snapshot with a name length > 80 is currently broken? I guess that bad things can happen if I do an LSSNAP in the .snap directory that has one of these 'long names'. Any idea why there was such a limitation? And how sure are we that this change won't break something else?

I didn't find there has any special limitation for the snapshot name in ceph. The current code is also buggy if the snapshot name is too long, which is larger than 80 - 2 * sizeof('_') + sizeof(<inode#>) == 65 chars, since it will always truncate the long snap name to 80 chars, then if you do LSSNAP the MDS may won't receive the exact long snap name and couldn't parse the correct <inode#>, just as in your kernel mail list mentioned:

The MDS logs:

 747 2022-03-09T11:06:01.308+0800 152187fed700  4 mds.0.server handle_client_request client_request(client.4216:16 lookupsnap #0x10000000001//_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 2022-03-09T11:06:01.308545+0800 caller_uid=0, caller_gid=0{0,}) v4
  748 2022-03-09T11:06:01.309+0800 152187fed700 20 mds.0.5 get_session have 0x5593da9c6d00 client.4216 v1:10.72.47.117:0/2358830768 state open
  749 2022-03-09T11:06:01.309+0800 152187fed700 15 mds.0.server  oldest_client_tid=16
  750 2022-03-09T11:06:01.309+0800 152187fed700  7 mds.0.cache request_start request(client.4216:16 nref=2 cr=0x5593daab6840)
  751 2022-03-09T11:06:01.309+0800 152187fed700  7 mds.0.server dispatch_client_request client_request(client.4216:16 lookupsnap #0x10000000001//_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 2022-03-09T11:06:01.308545+0800 caller_uid=0, caller_gid=0{0,}) v4
  752 2022-03-09T11:06:01.309+0800 152187fed700 10 mds.0.server rdlock_path_pin_ref request(client.4216:16 nref=2 cr=0x5593daab6840) #0x10000000001//_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777
  753 2022-03-09T11:06:01.309+0800 152187fed700  7 mds.0.cache traverse: opening base ino 0x10000000001 snap head
  754 2022-03-09T11:06:01.309+0800 152187fed700 12 mds.0.cache traverse: path seg depth 0 '' snapid head
  755 2022-03-09T11:06:01.309+0800 152187fed700 10 mds.0.cache traverse: snapdir
  756 2022-03-09T11:06:01.309+0800 152187fed700 12 mds.0.cache traverse: path seg depth 1 '_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777' snapid snapdir
  757 2022-03-09T11:06:01.309+0800 152187fed700 10  mds.0.cache.snaprealm(0x10000000000 seq 2 0x5593daaa6000) resolve_snapname '_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777' in [0,head]
  758 2022-03-09T11:06:01.309+0800 152187fed700 10  mds.0.cache.snaprealm(0x10000000000 seq 2 0x5593daaa6000)  _123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 parses to name '123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345' dirino 0x1999999999
  759 2022-03-09T11:06:01.309+0800 152187fed700 15  mds.0.cache.snaprealm(0x10000000000 seq 2 0x5593daaa6000)  ? snap(2 0x10000000000 '123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345' 2022-03-09T10:52:39.357824+0800)
  760 2022-03-09T11:06:01.309+0800 152187fed700 10  mds.0.cache.snaprealm(0x1 seq 1 0x5593d5c6cc00) resolve_snapname '_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777' in [2,head]
  761 2022-03-09T11:06:01.309+0800 152187fed700 10  mds.0.cache.snaprealm(0x1 seq 1 0x5593d5c6cc00)  _123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 parses to name '123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345' dirino 0x1999999999
  762 2022-03-09T11:06:01.309+0800 152187fed700 10 mds.0.cache traverse: snap _123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 -> 0
  763 2022-03-09T11:06:01.309+0800 152187fed700 10 mds.0.server FAIL on error -2
  764 2022-03-09T11:06:01.309+0800 152187fed700  7 mds.0.server reply_client_request -2 ((2) No such file or directory) client_request(client.4216:16 lookupsnap #0x10000000001//_123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777 2022-03-09T11:06:01.308545+0800 caller_uid=0, caller_gid=0{0,}) v4

Actually the full long snap name:

Should be:
123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_1099511627777  <--- has 81 chars

Not:
123456qwertasdfgzxcvb7890yuiophjklnm123456qwertasdfgzxcvb78912345_109951162777  <--- has 80 chars

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't come across such a limitation. maybe @gregsfortytwo might know some history...

Copy link
Member

Choose a reason for hiding this comment

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

Nope, saw this from the mailing list post and it was a surprise to me. I thought there were plenty of things generating long names so I'm surprised this hasn't come up before.

Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

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

Otherwise looks good.

@dvanders
Copy link
Contributor

dvanders commented Apr 2, 2022

@lxbsz thanks, lgtm. Will this be backported to P and Q?

@lxbsz
Copy link
Member Author

lxbsz commented Apr 7, 2022

@lxbsz thanks, lgtm. Will this be backported to P and Q?

Yeah, this will be backported together with the fscrypt feature later.

@lxbsz
Copy link
Member Author

lxbsz commented Apr 14, 2022

jenkins retest this please

The length of encrypted the snapshot name will be longer than normal
name and we need the whole encrypted name in kclient to do the base64
decode.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
@lxbsz
Copy link
Member Author

lxbsz commented Apr 18, 2022

jenkins retest this please

2 similar comments
@lxbsz
Copy link
Member Author

lxbsz commented Apr 25, 2022

jenkins retest this please

@vshankar
Copy link
Contributor

jenkins retest this please

@djgalloway djgalloway changed the base branch from master to main May 25, 2022 20:03
@vshankar
Copy link
Contributor

jenkins test make check

@vshankar vshankar added wip-vshankar-testing and removed wip-vshankar-fscrypt CephFS fscrypt changes labels Oct 28, 2022
vshankar added a commit to vshankar/ceph that referenced this pull request Dec 1, 2022
* refs/pull/45192/head:
	mds: use the whole string as the snapshot long name

Reviewed-by: Jos Collin <jcollin@redhat.com>
Reviewed-by: Nikhilkumar Shelke <nshelke@redhat.com>
Reviewed-by: Ramana Raja <rraja@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

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

@vshankar
Copy link
Contributor

vshankar commented Dec 9, 2022

jenkins retest this please

vshankar added a commit to vshankar/ceph that referenced this pull request Dec 12, 2022
* refs/pull/45192/head:
	mds: use the whole string as the snapshot long name

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Jos Collin <jcollin@redhat.com>
Reviewed-by: Nikhilkumar Shelke <nshelke@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Ramana Raja <rraja@redhat.com>
@vshankar
Copy link
Contributor

jenkins render docs

@vshankar
Copy link
Contributor

jenkins test docs

@vshankar vshankar merged commit aa403a9 into ceph:main Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cephfs Ceph File System
Projects
None yet
9 participants