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

fs: properly handle ENOTSUP in copyXAttrs #245

Merged

Conversation

sondavidb
Copy link
Contributor

Fixes #244. More context in the issue.

Filesystems without xattr support do not have any xattrs to copy. The syscall for this will return ENOTSUP to indicate this, but continuity will treat it as a regular error. This change will return nil if this call returns ENOTSUP.

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp requested a review from dmcgowan July 23, 2024 16:33
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

fs/copy_linux.go Outdated
Comment on lines 65 to 67
xattrKeys, err := sysx.LListxattr(src)
if err != nil {
if err == unix.ENOTSUP {
Copy link
Member

Choose a reason for hiding this comment

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

Oh! Actually; this is handling an error returned by sysx, which is not a raw stdlib / syscall package, perhaps better to use errors.Is() here?

Some discussion with @robmry and @djs55 (we happened to be looking into a similar issue), and there's some discussion if EOPNOTSUPP should be handled here; this was related to https://elixir.bootlin.com/linux/v6.10/source/fs/fuse/xattr.c#L23

Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps better to use errors.Is() here

Makes sense, pushed the change

there's some discussion if EOPNOTSUPP should be handled here

It seems pretty reasonable to me, since the fuse_getxattr call would also fail in this use case. LMK and I can add add a check for this condition

Filesystems without xattr support do not have any xattrs to copy. The
syscall for this will return ENOTSUP to indicate this, but continuity
will treat it as a regular error. This change will return nil if this
call returns ENOTSUP.

Signed-off-by: David Son <[email protected]>
@sondavidb sondavidb force-pushed the properly-handle-fs-without-xattrs branch from 627d7a1 to c494f3d Compare July 25, 2024 18:22
@estesp
Copy link
Member

estesp commented Jul 25, 2024

haven't had time to look deeper, but this CI test failure is strange; I don't think we have flakes in this project, so is this being caused by the change:

=== RUN   TestDiffDirChangeWithOverlayfs
    diff_test.go:249: failed diff dir change: Unexpected number of changes:
        got(5):
        	modify	/dir1
        	delete	/dir1/d
        	modify	/dir1/f
        	modify	/dir2/d/f
        	delete	/dir3/.wh..opq
        expected(8):
        	modify	/dir1
        	delete	/dir1/d
        	modify	/dir1/f
        	modify	/dir2
        	modify	/dir2/d
        	modify	/dir2/d/f
        	modify	/dir3
        	delete	/dir3/.wh..opq
--- FAIL: TestDiffDirChangeWithOverlayfs (0.00s)

@thaJeztah
Copy link
Member

@estesp I think I saw the same failure on #242

wondering if it's changes on the runners

@AkihiroSuda
Copy link
Member

Please rebase to pass the CI

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Merging, assuming that the merge commit will pass the CI

@AkihiroSuda AkihiroSuda merged commit 75b1c65 into containerd:main Oct 26, 2024
9 of 13 checks passed
@sondavidb sondavidb deleted the properly-handle-fs-without-xattrs branch November 1, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] CopyDir fails on systems without xattr support
4 participants