Skip to content
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

[bug:1785094] rename dir1 to another existing dir2 cause dir1 glusterfa link file deleted #1014

Closed
gluster-ant opened this issue Mar 12, 2020 · 8 comments
Labels
Migrated Type:Bug wontfix Managed by stale[bot]

Comments

@gluster-ant
Copy link
Collaborator

URL: https://bugzilla.redhat.com/1785094
Creator: zz.sh.cynthia at gmail
Time: 20191219T06:28:20

Description of problem:
rename a dir1 to another existing dir2 cause dir1 glusterfs link file in .glusterfs/xx/xx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx disappear

Version-Release number of selected component (if applicable):

glusterfs7.0
How reproducible:

Steps to Reproduce:
1> Mkdir dir1 dir2
2> Touch some files in both dir1 and dir2
3> Rename dir1 dir2 * //this will fail with “rename: dir1: rename to dir2 failed: Directory not empty”
4> Check the glusterfs link file in .glusterfs/xx/xx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx this file will disappear

Actual results:

Expected results:
glusterfs link file should not disappear.

Additional info:
this issue is permanent in glusterfs7.0, very easy to reproduce.

@gluster-ant
Copy link
Collaborator Author

Time: 20191220T07:52:25
zz.sh.cynthia at gmail commented:
This problem is permanent. From my investigation, for both glusterfs3.12.15 and glusterfs7.0 the root cause seems to be the posix_rename of glusterfsd side firstly unlink the glusterfs link (in posix_handle_unset) and then it fails in
sys_rename(since the target already exists), then it does not restore the glusterfs link( file link 1d6febd3-875c-4879-a370-c4828e0052c3 in .glusterfs/1d/6f directory). I think the correct practice should be either restore the deleted glusterfs link file after sys_rename fail or change to firstly call sys_rename then delete the glusterfs link( I test this and seems with my code change this problem is gone).
I would like your opinion on this issue, this issue is permanent, you can try in your own env. Thanks!

following is the reproduce steps:
1> Mkdir dir1 dir2
2> Touch some files in both dir1 and dir2
3> Rename dir1 dir2 * //this will fail with “rename: dir1: rename to dir2 failed: Directory not empty”
4> Check the glusterfs link file in .glusterfs/xx/xx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx this file will disappear
5> Ls dir1 when dht is enabled in glusterfs3.12 ls command fails to show dir1 contents

enclosed is my test patch, with my patch there is no such issue.

@gluster-ant
Copy link
Collaborator Author

Time: 20191220T07:54:28
zz.sh.cynthia at gmail commented:
Created attachment 1646749
patch for ls dir return empty after rename dir to another existing dir

firstly sys_rename, only remove glusterfs metadata( glusterfs gfid link file) when sys_rename has been successfully executed.

@gluster-ant
Copy link
Collaborator Author

Time: 20191223T12:38:35
ravishankar at redhat commented:
Could you send the patch for review on gerrit please?

@gluster-ant
Copy link
Collaborator Author

Time: 20191223T12:41:01
ravishankar at redhat commented:
The patch workflow is @ https://docs.gluster.org/en/latest/Developer-guide/Simplified-Development-Workflow/ but I think you already have sent patches before. :-)

@gluster-ant
Copy link
Collaborator Author

Time: 20191224T05:37:09
zz.sh.cynthia at gmail commented:
https://review.gluster.org/#/c/glusterfs/+/23918/
please help to check

@gluster-ant
Copy link
Collaborator Author

Time: 20191224T09:56:25
bugzilla-bot at gluster.org commented:
REVIEW: https://review.gluster.org/23918 (put sys_rename ahead of deleting gfid link) posted (#8) for review on master by None

@stale
Copy link

stale bot commented Oct 8, 2020

Thank you for your contributions.
Noticed that this issue is not having any activity in last ~6 months! We are marking this issue as stale because it has not had recent activity.
It will be closed in 2 weeks if no one responds with a comment here.

@stale stale bot added the wontfix Managed by stale[bot] label Oct 8, 2020
@stale
Copy link

stale bot commented Oct 23, 2020

Closing this issue as there was no update since my last update on issue. If this is an issue which is still valid, feel free to open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Migrated Type:Bug wontfix Managed by stale[bot]
Projects
None yet
Development

No branches or pull requests

1 participant