Skip to content

fs: properly handle ENOTSUP in copyXAttrs#245

Merged
AkihiroSuda merged 1 commit intocontainerd:mainfrom
sondavidb:properly-handle-fs-without-xattrs
Oct 26, 2024
Merged

fs: properly handle ENOTSUP in copyXAttrs#245
AkihiroSuda merged 1 commit intocontainerd:mainfrom
sondavidb:properly-handle-fs-without-xattrs

Conversation

@sondavidb
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

wondering if it's changes on the runners

@AkihiroSuda
Copy link
Copy Markdown
Member

Please rebase to pass the CI

Copy link
Copy Markdown
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
@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