Bug #38832
closedmds: fail to resolve snapshot name contains '_'
0%
Description
We observed the following issue on latest centos 7.6 kernel && kernel v5.0.3.
We mount ceph in /cephk:
mount -t ceph lumupgtest.cern.ch:6789:/quotadir /cephk/ -o name=admin,secret=xxx
/cephk has a subdir asdf:
# ls -l /cephk total 102773 drwxr-xr-x 2 root root 0 Mar 20 17:07 asdf -rw-r--r-- 1 root root 105239036 Mar 19 13:16 linux-5.0.3.tar.xz
Previously created snapshots (in /cephk/.snap) are not listable from the subdir asdf:
# ls /cephk/asdf/.snap ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_170936_1099511812927: No such file or directory ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_171215_1099511812927: No such file or directory ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_171230_1099511812927: No such file or directory ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_172736_1099511812927: No such file or directory _hourly_2019-03-20_170936_1099511812927 _hourly_2019-03-20_171230_1099511812927 _hourly_2019-03-20_171215_1099511812927 _hourly_2019-03-20_172736_1099511812927
We can fix by listing the dir from where it was snapshotted; afterwards the snap can be listed from the subdir:
# ls /cephk/.snap/hourly_2019-03-20_170936 asdf linux-5.0.3.tar.xz # ls /cephk/asdf/.snap ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_171215_1099511812927: No such file or directory ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_171230_1099511812927: No such file or directory ls: cannot access /cephk/asdf/.snap/_hourly_2019-03-20_172736_1099511812927: No such file or directory _hourly_2019-03-20_170936_1099511812927 _hourly_2019-03-20_171230_1099511812927 _hourly_2019-03-20_171215_1099511812927 _hourly_2019-03-20_172736_1099511812927 # ls /cephk/asdf/.snap/_hourly_2019-03-20_170936_1099511812927 #
Updated by Dan van der Ster about 5 years ago
Found the cause: the subdir snaps are not visible if they have a _ in the original snapshot name. Snaps without _ do no show this symptom.
Presumably the _ is conflicting with the special _ in the subdir snap name.
Updated by Zheng Yan about 5 years ago
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]; snprintf(nm, sizeof(nm), "_%s_%llu", name.c_str(), (unsigned long long)ino); long_name = nm; } return long_name; }
yes, leading '_' is special. please rename these snapshot
Updated by Zheng Yan about 5 years ago
- Project changed from Linux kernel client to CephFS
- Subject changed from snaps visible from subdir not visible until stat from the origin to mds: disallow leading '_' for snapshot name
- Category deleted (
Snapshots)
Updated by Patrick Donnelly about 5 years ago
- Subject changed from mds: disallow leading '_' for snapshot name to mds: prevent snapshots from being created with "_"
- Status changed from New to 12
- Target version set to v15.0.0
- Start date deleted (
03/20/2019) - Backport set to nautilus,mimic
- Component(FS) Client, MDS added
- Labels (FS) snapshots, task(easy), task(intern) added
Zheng, what was the motivation for the change to append this information to the snap name after the final _? re: 07e7007d0d7fcb20a92a98a0c7e5d4855c795cd6
Updated by Zheng Yan about 5 years ago
Server::handle_client_mksnap already contains following code:
if (snapname.length() == 0 || snapname[0] == '_') { respond_to_request(mdr, -EINVAL); return; }
Dan van der Ster, how did you create snapshot with leading _?
Updated by Dan van der Ster about 5 years ago
There's some confusion here -- we created a snapshot named 'hourly_2019-03-20_172736'. The internal _ chars are causing the problem.
Updated by Zheng Yan about 5 years ago
- Subject changed from mds: prevent snapshots from being created with "_" to mds: fail to resolve snapshot name contains '_'
Updated by Zheng Yan about 5 years ago
- Status changed from Need More Info to Fix Under Review
- Pull request ID set to 27511
Updated by Patrick Donnelly almost 5 years ago
- Status changed from Fix Under Review to Pending Backport
- Assignee set to Zheng Yan
Updated by Nathan Cutler almost 5 years ago
- Copied to Backport #39472: mimic: mds: fail to resolve snapshot name contains '_' added
Updated by Nathan Cutler almost 5 years ago
- Copied to Backport #39473: nautilus: mds: fail to resolve snapshot name contains '_' added
Updated by Nathan Cutler almost 5 years ago
- Status changed from Pending Backport to Resolved
Updated by Patrick Donnelly over 3 years ago
Patrick Donnelly wrote:
Zheng, what was the motivation for the change to append this information to the snap name after the final _? re: 07e7007d0d7fcb20a92a98a0c7e5d4855c795cd6
It's actually from https://github.com/ceph/ceph/commit/068553473c8246c90a3e253c8006a9dd36aceeac
The motivation appears to be to differentiate between snapshots done on a directory and inherited snapshots. The appended number is the inode number of the directory "owning" the snapshot.