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

add ratime mount_setattr test #2658

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

Conversation

lengrongfu
Copy link
Collaborator

Fixes: #1534

@lengrongfu
Copy link
Collaborator Author

# Start group mounts_recursive
1 / 17 : ratime_test : not ok
        container stderr was not empty, found : ERROR libcontainer::rootfs::mount: failed to mount Mount { destination: "/ratime", typ: None, source: Some("/tmp/ratime_dir"), options: Some(["rbind", "ratime"]) }: syscall
ERROR libcontainer::process::container_init_process: failed to prepare rootfs err=Mount(Syscall(Nix(EINVAL)))
ERROR libcontainer::process::container_intermediate_process: failed to initialize container process: failed to prepare rootfs
ERROR libcontainer::process::container_main_process: failed to wait for init ready: failed to receive. "waiting for init ready". BrokenChannel
ERROR libcontainer::container::builder_impl: failed to run container process err=Channel(ReceiveError { msg: "waiting for init ready", source: BrokenChannel })
ERROR youki: error in executing command: failed to receive. "waiting for init ready". BrokenChannel

ratime can't mount, need to check whether there is any problem with the implementation.

@codecov-commenter
Copy link

codecov-commenter commented Jan 29, 2024

Codecov Report

Merging #2658 (7d1f5bd) into main (18f3e0b) will increase coverage by 0.00%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2658   +/-   ##
=======================================
  Coverage   65.21%   65.21%           
=======================================
  Files         133      133           
  Lines       16981    16981           
=======================================
+ Hits        11074    11075    +1     
+ Misses       5907     5906    -1     

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Feb 1, 2024

Hey @lengrongfu , I have also encountered somewhat similar errors in other mount tests when I was running locally. The Root Cause for them was that the /tmp dir is not mounted with the expected attributes by default, and thus when we create the container dir for testing there, it does not have the correct mount attributes and test fails.

Can you check if this issue also has same RC?

@lengrongfu
Copy link
Collaborator Author

Hey @lengrongfu , I have also encountered somewhat similar errors in other mount tests when I was running locally. The Root Cause for them was that the /tmp dir is not mounted with the expected attributes by default, and thus when we create the container dir for testing there, it does not have the correct mount attributes and test fails.

Can you check if this issue also has same RC?

ok, i will to check.

@lengrongfu
Copy link
Collaborator Author

@YJDoc2 I found that it has nothing to do with the /tmp directory. It may be related to the mount option.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Feb 12, 2024

@YJDoc2 I found that it has nothing to do with the /tmp directory. It may be related to the mount option.

Hey, yes that's what I meant : the /tmp directory might not be mounted with the options we need. You can try checking cat /proc/mounts output and corresponding docs to see if that provides any help

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Feb 20, 2024

Hey @lengrongfu , did you find out anything on this?

@lengrongfu
Copy link
Collaborator Author

Hey @lengrongfu , did you find out anything on this?

Sorry, I didn't find any more information.

@lengrongfu lengrongfu force-pushed the test/add_ratime_test branch 2 times, most recently from cc7c436 to 4fe3fd0 Compare March 15, 2024 14:17
Signed-off-by: lengrongfu <lenronfu@gmail.com>
Copy link
Collaborator

@YJDoc2 YJDoc2 left a comment

Choose a reason for hiding this comment

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

Hey, @lengrongfu , the PR looks good, one very minor nitpick .

Also may I ask you for one change : Instead of adding the ratime bugfix in libcontainer in this PR, can you open a separate one just containing that fix, and then rebase this on top of it after merge? The reason I'm asking is so that in changelog, it gets properly added as a bug fix, and does not hide under tests, as this PR will go under test category.

two_metadata.mtime(),
std::time::SystemTime::now()
);
if one_metadata.atime() == two_metadata.atime() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if one_metadata.atime() == two_metadata.atime() {
if one_metadata.atime() >= two_metadata.atime() {

Original == check should be enough, but we can be extra cautious and expect the new atime to be strictly greater than old, as we are sleeping in between.

return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!(
"update access time for file {:?}, expected update",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"update access time for file {:?}, expected update",
"expected old access time to be less than new access time after update for file {:?}, found old : {old}, new {new} ",

@lengrongfu
Copy link
Collaborator Author

I'm not sure if this is correct, because runc implementation is similar. but runc can't success running the test.
https://github.com/opencontainers/runc/blob/18c313be729dd02b17934af41e32116a28b4b3bf/libcontainer/specconv/spec_linux.go#L125

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 26, 2024

I'm not sure if this is correct, because runc implementation is similar. but runc can't success running the test.
https://github.com/opencontainers/runc/blob/18c313be729dd02b17934af41e32116a28b4b3bf/libcontainer/specconv/spec_linux.go#L125

Yes, you are right. From what I checked it seems that the mount options are dependent on the specific flag being ORed or not ORed . for if for time we are ORing the flag SET_ATIME (suppose) , then for noatime we simply do not OR that flag in the argument. I believe our setup regarding this particular part is similar to runc, so the original code should be correct.

What do you think?

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Apr 29, 2024

@lengrongfu ping!

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

Successfully merging this pull request may close these issues.

Test for recursive mount attrs
4 participants