-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Two xfs file systems with same UUID can not be mounted on the same sy… #6650
Conversation
Hi @henry118. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me.
Is it possible to reproduce the issue by expanding https://github.com/containerd/containerd/blob/main/snapshots/devmapper/snapshotter_test.go? Does GitHub Actions have mkfs.xfs?
Build succeeded.
|
The errors happens after |
If we make two snapshots with xfs and mount both of them, would it reproduce the error? A lot of containerd tests actually run syscalls such as mount. |
Can you point me some sample unit tests as you mentioned? so I can use them as references for implementing the new test cases... Thanks! |
How about this one? I believe that mount here is not mocked. containerd/snapshots/devmapper/snapshotter_test.go Lines 126 to 130 in b521429
|
Great thanks, will look into it. |
|
||
ctx := context.Background() | ||
ctx = namespaces.WithNamespace(ctx, "testsuite") | ||
tempDir, err := os.MkdirTemp("", "snapshot-suite-usage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use t.TempDir instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic was taken from https://github.com/containerd/containerd/blob/main/snapshots/devmapper/snapshotter_test.go#L89
I think it was chosen because we want to explicitly specify a pattern for the temp directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, we simply didn't have t.TempDir when we first wrote that code. It is added in Go 1.15.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. However i still believe the original logic works better. For instance we can easily locate the path when we have to debug a failing test case with an explicitly specified dir pattern. I actually found it useful when I wrote this unit test. But if you have a strong opinion about this I am fine with making the change.
var ( | ||
sizeBytes int64 = 1048576 // 1MB | ||
baseApplier = fstest.Apply(fstest.CreateRandomFile("/a", 12345679, sizeBytes, 0777)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? baseApplier
is needed to create a snapshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (not 100% sure, sorry) that Prepare() returns a XFS-formatted devmapper device. So mounting two of them is enough to reproduce the original issue. Would it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. we have to prepare an additional snapshot from a base one.
err := dmsetup.CreatePool(config.PoolName, loopDataDevice, loopMetaDevice, 64*1024/dmsetup.SectorSize) | ||
assert.NilError(t, err, "failed to create pool %q", config.PoolName) | ||
|
||
snap, err := NewSnapshotter(context.Background(), config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about taking the passed ctx instead of making a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Updated
Two xfs file systems with same UUID can not be mounted on the same system. However devmapper snapshots will have same UUID as original filesystem. This patch fixes the bug by mounting a xfs file system with "nouuid" option. Signed-off-by: Henry Wang <henwang@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/ok-to-test
Build succeeded.
|
/ok-to-test |
recheck |
1 similar comment
recheck |
Build succeeded.
|
@FFFrog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes issue: #6587
Two xfs file systems with same UUID can not be mounted on the same system. However devmapper snapshots will have same UUID as original filesystem.
This patch fixes the bug by mounting a xfs file system with "nouuid" option.
Signed-off-by: Henry Wang henwang@amazon.com