Project

General

Profile

Bug #38832

mds: fail to resolve snapshot name contains '_'

Added by Dan van der Ster 5 months ago. Updated 27 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Source:
Community (user)
Tags:
Backport:
nautilus,mimic
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Client, MDS
Labels (FS):
snapshots, task(easy), task(intern)
Pull request ID:

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
#

Related issues

Copied to fs - Backport #39472: mimic: mds: fail to resolve snapshot name contains '_' Resolved
Copied to fs - Backport #39473: nautilus: mds: fail to resolve snapshot name contains '_' Resolved

History

#1 Updated by Dan van der Ster 5 months 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.

#2 Updated by Zheng Yan 5 months 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

#3 Updated by Zheng Yan 5 months ago

  • Project changed from Linux kernel client to fs
  • Subject changed from snaps visible from subdir not visible until stat from the origin to mds: disallow leading '_' for snapshot name
  • Category deleted (Snapshots)

#4 Updated by Patrick Donnelly 4 months ago

  • Subject changed from mds: disallow leading '_' for snapshot name to mds: prevent snapshots from being created with "_"
  • Status changed from New to Verified
  • 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

#5 Updated by Zheng Yan 4 months 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 _?

#6 Updated by Zheng Yan 4 months ago

  • Status changed from Verified to Need More Info

#7 Updated by Dan van der Ster 4 months ago

There's some confusion here -- we created a snapshot named 'hourly_2019-03-20_172736'. The internal _ chars are causing the problem.

#8 Updated by Zheng Yan 4 months ago

  • Subject changed from mds: prevent snapshots from being created with "_" to mds: fail to resolve snapshot name contains '_'

#9 Updated by Zheng Yan 4 months ago

  • Status changed from Need More Info to Need Review
  • Pull request ID set to 27511

#10 Updated by Patrick Donnelly 4 months ago

  • Status changed from Need Review to Pending Backport
  • Assignee set to Zheng Yan

#11 Updated by Nathan Cutler 4 months ago

  • Copied to Backport #39472: mimic: mds: fail to resolve snapshot name contains '_' added

#12 Updated by Nathan Cutler 4 months ago

  • Copied to Backport #39473: nautilus: mds: fail to resolve snapshot name contains '_' added

#13 Updated by Nathan Cutler 27 days ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF