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

mtime in .snap directory is not stable #4071

Closed
xhernandez opened this issue Mar 23, 2023 · 0 comments · Fixed by #4072
Closed

mtime in .snap directory is not stable #4071

xhernandez opened this issue Mar 23, 2023 · 0 comments · Fixed by #4072

Comments

@xhernandez
Copy link
Contributor

xhernandez commented Mar 23, 2023

The mtime, ctime and atime of the .snap virtual directory and its contents where the available snapshots can be accessed are not stable. They change each time a request is sent, even if it's a read only operation like a stat.

This will constantly invalidate cache contents in Gluster but in some cases, like NFS clients, this will cause a worse problem because a change in mtime while reading the directory contents causes the nfs client to retry the readdir.

This causes an infinite loop when an ls is done from a recent linux kernel nfs client on .snap directory.

xhernandez added a commit to xhernandez/glusterfs that referenced this issue Mar 24, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: gluster#4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
xhernandez added a commit that referenced this issue Mar 24, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: #4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
xhernandez added a commit to xhernandez/glusterfs that referenced this issue Mar 27, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: gluster#4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
xhernandez added a commit to xhernandez/glusterfs that referenced this issue Mar 27, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: gluster#4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
xhernandez added a commit to xhernandez/glusterfs that referenced this issue Mar 27, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: gluster#4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Shwetha-Acharya pushed a commit that referenced this issue Mar 29, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: #4071

Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Shwetha-Acharya pushed a commit that referenced this issue Apr 4, 2023
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.

Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.

The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.

For now, just return a constant value for these specific entries.

Fixes: #4071

Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant