Skip to content

libcephfs/client: pin inode/dentry for an opened directory#60909

Merged
vshankar merged 4 commits intoceph:mainfrom
ifed01:wip-ifed-client-cache-trim-repro
Feb 11, 2025
Merged

libcephfs/client: pin inode/dentry for an opened directory#60909
vshankar merged 4 commits intoceph:mainfrom
ifed01:wip-ifed-client-cache-trim-repro

Conversation

@ifed01
Copy link
Contributor

@ifed01 ifed01 commented Dec 2, 2024

Reproduces: https://tracker.ceph.com/issues/69092
Fixes: https://tracker.ceph.com/issues/69092

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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
  • jenkins test rook e2e

@ifed01 ifed01 added the tests label Dec 2, 2024
@github-actions github-actions bot added build/ops cephfs Ceph File System labels Dec 2, 2024
@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch from 7c63a08 to 4f122a0 Compare December 2, 2024 16:54
@ifed01 ifed01 requested review from joscollin and vshankar December 2, 2024 16:55
@ifed01 ifed01 changed the title test/libcephfs: reproduce an issue after client cache trimming test/libcephfs: reproduce internal data inconsistency after client cache trimming Dec 2, 2024
@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch 2 times, most recently from ebb8b23 to cff1f39 Compare December 3, 2024 13:03
@ifed01 ifed01 changed the title test/libcephfs: reproduce internal data inconsistency after client cache trimming libcephfs/client: pin inode/dentry for an opened directory Dec 12, 2024
@batrick batrick requested review from a team and dparmar18 December 18, 2024 14:39
@vshankar vshankar self-assigned this Dec 18, 2024
@dparmar18 dparmar18 self-assigned this Dec 19, 2024
Copy link
Contributor

@mchangir mchangir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor issue

@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch from 1573d65 to 78433c2 Compare December 26, 2024 12:00
@vshankar
Copy link
Contributor

jenkins test windows

@vshankar
Copy link
Contributor

jenkins test make check

@vshankar
Copy link
Contributor

This PR is under test in https://tracker.ceph.com/issues/69375.

@ifed01
Copy link
Contributor Author

ifed01 commented Dec 27, 2024

jenkins test windows

if (fhp) {
*fhp = _create_fh(in, flags, cmode, perms);
// ceph_flags_sys2wire/ceph_flags_to_mode() calls above transforms O_DIRECTORY flag
// into CEPH_FILE_MODE_PIN mode. Although this mode is used at server size

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: size -> side

Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vshankar
Copy link
Contributor

vshankar commented Jan 2, 2025

jenkins test windows

2 similar comments
@vshankar
Copy link
Contributor

vshankar commented Jan 2, 2025

jenkins test windows

@vshankar
Copy link
Contributor

vshankar commented Jan 6, 2025

jenkins test windows

@vshankar
Copy link
Contributor

vshankar commented Jan 6, 2025

Windows failure seems to be real

++ echo 'src/client/Client.cc
src/test/libcephfs/CMakeLists.txt
src/test/libcephfs/client_cache.cc'
++ egrep -v '^container/'
++ wc -l
+ '[' 3 -gt 0 ']'
+ return 1

I haven't looked deeper though. @ifed01

@vshankar
Copy link
Contributor

vshankar commented Jan 7, 2025

Windows failure seems to be real

++ echo 'src/client/Client.cc
src/test/libcephfs/CMakeLists.txt
src/test/libcephfs/client_cache.cc'
++ egrep -v '^container/'
++ wc -l
+ '[' 3 -gt 0 ']'
+ return 1

I haven't looked deeper though. @ifed01

This is happening with other PRs too, so its probably unrelated to this change (however, it blocks merging).

@ifed01
Copy link
Contributor Author

ifed01 commented Jan 9, 2025

jenkins test windows

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch from 4bd086d to c9d7345 Compare January 27, 2025 08:09
@ifed01
Copy link
Contributor Author

ifed01 commented Jan 27, 2025

jenkins test make check

@ifed01
Copy link
Contributor Author

ifed01 commented Jan 27, 2025

jenkins test api

@ifed01
Copy link
Contributor Author

ifed01 commented Jan 27, 2025

jenkins test make check

1 similar comment
@ifed01
Copy link
Contributor Author

ifed01 commented Jan 27, 2025

jenkins test make check

@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch 2 times, most recently from 9fdfbec to be97718 Compare January 28, 2025 04:29
@ifed01
Copy link
Contributor Author

ifed01 commented Jan 28, 2025

jenkins test windows

@vshankar
Copy link
Contributor

vshankar commented Feb 4, 2025

jenkins retest this please

@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch 2 times, most recently from bf96ced to aa2d946 Compare February 5, 2025 10:52
@github-actions github-actions bot added the common label Feb 5, 2025
@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch from aa2d946 to 51e4e1a Compare February 5, 2025 10:53
@ifed01
Copy link
Contributor Author

ifed01 commented Feb 5, 2025

The root cause for reoccurring Windows tests failures is lack of O_DIRECTORY flag translation in ceph_flags_sys2wire() (defined in src/common/ceph_fs.cc).
This function explicitly bypasses this translation under Windows:

#ifndef _WIN32
       ceph_sys2wire(O_DIRECTORY);
       ceph_sys2wire(O_NOFOLLOW);
       // In some cases, FILE_FLAG_BACKUP_SEMANTICS may be used instead
       // of O_DIRECTORY. We may need some workarounds in order to handle
       // the fact that those flags are not available on Windows.
#endif

As a result no CEPH_FILE_MODE_PIN is returned by ceph_flags_to_mode() and opened directory gets no pinning. Which in turn exposes it to cache trimming..
@petrutlucian94 - do you think we really need that "ifndef" block given the fact that O_DIRECTORY is actually defined in include/win32/fs_compat.h?

@petrutlucian94
Copy link
Contributor

As long as those flags don't propagate to Windows functions, I think we can remove the ifdefs.

…er Win

in ceph_flags_sys2wire()

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
@ifed01 ifed01 force-pushed the wip-ifed-client-cache-trim-repro branch from 51e4e1a to 4badc83 Compare February 5, 2025 15:41
@ifed01 ifed01 added the win32 Specifix changes for the windows platform label Feb 5, 2025
@ifed01
Copy link
Contributor Author

ifed01 commented Feb 6, 2025

jenkins test make check

2 similar comments
@ifed01
Copy link
Contributor Author

ifed01 commented Feb 9, 2025

jenkins test make check

@ifed01
Copy link
Contributor Author

ifed01 commented Feb 9, 2025

jenkins test make check

@vshankar
Copy link
Contributor

Nice work @ifed01. Thx @petrutlucian94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ops cephfs Ceph File System common needs-review tests win32 Specifix changes for the windows platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants