ceph icon indicating copy to clipboard operation
ceph copied to clipboard

client, mds: update mtime and change attr for snapdir when snaps are created, deleted and renamed

Open vshankar opened this issue 3 years ago • 8 comments

Changes depend on https://github.com/ceph/ceph/pull/48086 - commits are included in this PR and would be removed when the dependent PR gets merged.

Contribution Guidelines

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
  • jenkins test windows

vshankar avatar Oct 06 '22 07:10 vshankar

Hm, I don't have any comments on the details, but at a bigger picture: why store the snap_mtime in the parent inode? Alternatives:

  1. store the mtime in the SnapRealm instead. It's a piece of snapshot metadata, and we store most of the snapshot metadata there, so it seems more natural? (Also: avoids inflating inodes.)
  2. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

gregsfortytwo avatar Oct 10 '22 15:10 gregsfortytwo

Hm, I don't have any comments on the details, but at a bigger picture: why store the snap_mtime in the parent inode? Alternatives:

  1. store the mtime in the SnapRealm instead. It's a piece of snapshot metadata, and we store most of the snapshot metadata there, so it seems more natural? (Also: avoids inflating inodes.)

I didn't think about that frankly. I think doing it this way would be feasible.

  1. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

vshankar avatar Oct 11 '22 05:10 vshankar

  1. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

Yeah exactly. I'm not sure what the implications are, or if that's actually any simpler than what's in this PR, but if we could do it all on the client without any protocol changes at all that's often a win.

gregsfortytwo avatar Oct 11 '22 05:10 gregsfortytwo

  1. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

Yeah exactly. I'm not sure what the implications are, or if that's actually any simpler than what's in this PR, but if we could do it all on the client without any protocol changes at all that's often a win.

Creating a snapshot should really not change mtime of its non-snapdir parent, isn't it?

vshankar avatar Oct 11 '22 05:10 vshankar

3. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

Yeah exactly. I'm not sure what the implications are, or if that's actually any simpler than what's in this PR, but if we could do it all on the client without any protocol changes at all that's often a win.

Creating a snapshot should really not change mtime of its non-snapdir parent, isn't it?

Hmm, I guess I'm not sure what the behavior is or should be. I assumed it changed the mtime since it's changing a piece of information attached to the inode. But I guess that would interact poorly with the mirror daemon or other backup software, and we may not update it since it's not an update which posix would talk about.

gregsfortytwo avatar Oct 11 '22 05:10 gregsfortytwo

  1. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

Yeah exactly. I'm not sure what the implications are, or if that's actually any simpler than what's in this PR, but if we could do it all on the client without any protocol changes at all that's often a win.

Creating a snapshot should really not change mtime of its non-snapdir parent, isn't it?

Hmm, I guess I'm not sure what the behavior is or should be. I assumed it changed the mtime since it's changing a piece of information attached to the inode. But I guess that would interact poorly with the mirror daemon or other backup software, and we may not update it since it's not an update which posix would talk about.

Right. Its only the immediate parent (snapdir) whose mtime/change_attr needs updation.

vshankar avatar Oct 11 '22 05:10 vshankar

On Mon, Oct 10, 2022 at 10:48 PM Venky Shankar @.***> wrote:

  1. Do we actually need snapdir-specific metadata? What are the downsides of just using the CInode's mtime and change attr?

Do you mean parent dirs mtime/change_attr? I.e., for /a/b/.snap/ use mtime/change_attr from directory b when a snap is created/deleted/renamed under .snap?

Yeah exactly. I'm not sure what the implications are, or if that's actually any simpler than what's in this PR, but if we could do it all on the client without any protocol changes at all that's often a win.

Creating a snapshot should really not change mtime of its non-snapdir parent, isn't it?

Hmm, does it not change the mtime? It's certainly changing characteristics of the directory, so I'd think it would change that. But perhaps it doesn't do so now — changing mtimes on snapshot creates would interact a bit strangely with backup systems and the mirror daemon.

Message ID: @.***>

gregsfortytwo avatar Oct 11 '22 09:10 gregsfortytwo

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

github-actions[bot] avatar Oct 16 '22 18:10 github-actions[bot]

jenkins test make check

vshankar avatar Oct 21 '22 04:10 vshankar

I wonder if the missing *times/rstats for the .snap dir is the reason rctime is going haywire for .snap dir in general. This popped up in my mind since we'd planned to use rctime as the deciding factor to optimize file-system crawl for ceph-mirroring.

mchangir avatar Oct 26 '22 10:10 mchangir

I wonder if the missing *times/rstats for the .snap dir is the reason rctime is going haywire for .snap dir in general. This popped up in my mind since we'd planned to use rctime as the deciding factor to optimize file-system crawl for ceph-mirroring.

I have no idea. From whatever I recall, an mds failover caused rstats for inodes (not only for snapdir) mess up all over the place.

vshankar avatar Oct 26 '22 11:10 vshankar

Fixed and updated. @lxbsz please take a look.

vshankar avatar Oct 28 '22 07:10 vshankar

jenkins test make check

vshankar avatar Oct 28 '22 08:10 vshankar

@lxbsz @ajarr fixed and updated.

vshankar avatar Nov 07 '22 04:11 vshankar

jenkins test api

vshankar avatar Dec 01 '22 04:12 vshankar

https://tracker.ceph.com/projects/cephfs/wiki/Main#08-Dec-2022

vshankar avatar Dec 08 '22 13:12 vshankar

https://tracker.ceph.com/projects/cephfs/wiki/Main#08-Dec-2022

Sorry - wrong branch/link. This is still under test.

vshankar avatar Dec 08 '22 13:12 vshankar

Fixed and updated. I also switched to using std::nullopt for std::optional.

vshankar avatar Jan 06 '23 04:01 vshankar

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

github-actions[bot] avatar Feb 22 '23 12:02 github-actions[bot]