Project

General

Profile

Actions

Bug #38832

closed

mds: fail to resolve snapshot name contains '_'

Added by Dan van der Ster about 5 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
% 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:
Crash signature (v1):
Crash signature (v2):

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 2 (0 open2 closed)

Copied to CephFS - Backport #39472: mimic: mds: fail to resolve snapshot name contains '_'ResolvedPrashant DActions
Copied to CephFS - Backport #39473: nautilus: mds: fail to resolve snapshot name contains '_'ResolvedWei-Chung ChengActions
Actions #1

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.

Actions #2

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

Actions #3

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)
Actions #4

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

Actions #5

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 _?

Actions #6

Updated by Zheng Yan about 5 years ago

  • Status changed from 12 to Need More Info
Actions #7

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.

Actions #8

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 '_'
Actions #9

Updated by Zheng Yan about 5 years ago

  • Status changed from Need More Info to Fix Under Review
  • Pull request ID set to 27511
Actions #10

Updated by Patrick Donnelly almost 5 years ago

  • Status changed from Fix Under Review to Pending Backport
  • Assignee set to Zheng Yan
Actions #11

Updated by Nathan Cutler almost 5 years ago

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

Updated by Nathan Cutler almost 5 years ago

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

Updated by Nathan Cutler almost 5 years ago

  • Status changed from Pending Backport to Resolved
Actions #14

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.

Actions

Also available in: Atom PDF