Skip to content

mds: update change_attr on dirfrag update #60781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hit1943
Copy link

@hit1943 hit1943 commented Nov 20, 2024

cephfs: when dir updates, the change_attr should always be increased by 1

Now, if a new dentry created under a dir frag whose change_attr is smaller than the dirstat's change_attr, the inode and inode->dirstat's change_attr will not increased, so the client will not be aware of updates of the directory by a getattr request.
So We should make sure that when a dentry is created or deleted in any directory fragment, the change_attr of the frag should be larger than the directory dirstat and increased by 1.

Fixes: https://tracker.ceph.com/issues/67831

@github-actions github-actions bot added the cephfs Ceph File System label Nov 20, 2024
@vshankar vshankar changed the title fix issue 67831 of cephfs: when dir updates, the change_attr should always be increased by 1 mds: update change_attr on dirfrag update Dec 26, 2024
@vshankar vshankar requested a review from a team December 26, 2024 06:13
@vshankar vshankar self-assigned this Jan 6, 2025
@vshankar
Copy link
Contributor

review nudge @kotreshhr

@ceph-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@dparmar18
Copy link
Contributor

This looks easily reproducible, I guess a py test case under ceph/qa/tasks/cephfs/test_fragment.py would be good to have.

Copy link
Contributor

@dparmar18 dparmar18 left a comment

Choose a reason for hiding this comment

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

https://jenkins.ceph.com/job/ceph-api/89632/console

/home/jenkins-build/build/workspace/ceph-api/src/mds/MDCache.cc:2342:12: error: no member named 'dirstat' in 'CInode::projected_inode'
        pi.dirstat.change_attr++;

projected inode doesn't have member dirstat.

@hit1943 hit1943 requested a review from dparmar18 March 14, 2025 07:02
@hit1943 hit1943 marked this pull request as draft March 14, 2025 07:06
@hit1943 hit1943 marked this pull request as ready for review March 14, 2025 07:11
@vshankar
Copy link
Contributor

@hit1943 Would you be able to push an update with the fixes?

@hit1943
Copy link
Author

hit1943 commented Mar 17, 2025

@hit1943 Would you be able to push an update with the fixes?

done

@dparmar18
Copy link
Contributor

@hit1943
Copy link
Author

hit1943 commented Mar 18, 2025

last push https://github.com/ceph/ceph/compare/b39385f2b92b0533f23c0f8ae956bb1d5256e520..c8ea6141fc479a0eb3b4da5c058841eba463dcad shows no changes,

there was something wrong with the github to sync changes, it show info:
"Checking for ability to merge automatically…Hang in there while we check the branch’s status"

so i push a blank commit and cancel it. Then i can see the files changed:

image

…ry fragment, the change_attr of the directory inode and directory dirstat should be always increased

    Fixes: https://tracker.ceph.com/issues/67831
    Signed-off-by: Tod Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cephfs Ceph File System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants