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
Conversation
12bbe7c
to
6a05384
Compare
looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine otherwise.
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]; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise looks good.
@lxbsz thanks, lgtm. Will this be backported to P and Q? |
Yeah, this will be backported together with the fscrypt feature later. |
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>
jenkins retest this please |
2 similar comments
jenkins retest this please |
jenkins retest this please |
jenkins test make check |
* 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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jenkins retest this please |
* 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>
jenkins render docs |
jenkins test docs |
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
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