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

fuse,meta: support GETFLAGS/SETFLAGS ioctl #2346

Merged
merged 1 commit into from
Aug 24, 2022
Merged

Conversation

qingyunha
Copy link
Contributor

No description provided.

@qingyunha
Copy link
Contributor Author

close #775

Hi, I have a init implement for support ioctl. It's not complete and I hope your help, see if this is the right direction

@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2022

Codecov Report

Merging #2346 (2830ebc) into main (e1c8d6a) will decrease coverage by 0.01%.
The diff coverage is 43.05%.

@@            Coverage Diff             @@
##             main    #2346      +/-   ##
==========================================
- Coverage   59.69%   59.68%   -0.02%     
==========================================
  Files         138      138              
  Lines       23341    23481     +140     
==========================================
+ Hits        13933    14014      +81     
- Misses       7596     7643      +47     
- Partials     1812     1824      +12     
Impacted Files Coverage Δ
pkg/fuse/fuse.go 76.64% <0.00%> (-1.14%) ⬇️
pkg/meta/interface.go 46.80% <ø> (ø)
pkg/vfs/vfs_unix.go 76.23% <0.00%> (-21.47%) ⬇️
pkg/meta/sql.go 64.29% <64.28%> (+0.13%) ⬆️
pkg/utils/buffer.go 91.48% <66.66%> (ø)
pkg/meta/redis.go 70.14% <68.00%> (+0.15%) ⬆️
pkg/meta/tkv.go 74.90% <70.37%> (+0.10%) ⬆️
pkg/meta/base.go 68.80% <75.00%> (+0.39%) ⬆️
pkg/meta/tkv_mem.go 86.61% <0.00%> (-0.71%) ⬇️
pkg/chunk/disk_cache.go 79.20% <0.00%> (-0.50%) ⬇️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@davies
Copy link
Contributor

davies commented Jul 10, 2022

@qingyunha This looks pretty good, some details could be tuned.

pkg/meta/base.go Outdated Show resolved Hide resolved
Copy link
Contributor

@zhijian-pro zhijian-pro left a comment

Choose a reason for hiding this comment

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

doMknod should check parent dir's flags.

if (pattr.Flags & FlagImmutable) != 0 {
    return syscall.EPERM
}

pkg/meta/base_test.go Outdated Show resolved Hide resolved
@zhijian-pro
Copy link
Contributor

doRename should check flags

if (sattr.Flags&FlagAppend) != 0 || (sattr.Flags&FlagImmutable) != 0 || (dattr.Flags&FlagImmutable) != 0 || (iattr.Flags&FlagAppend) != 0 || (iattr.Flags&FlagImmutable) != 0 {
	return syscall.EPERM
}

@SandyXSD
Copy link
Contributor

@qingyunha Do you have time to continue this PR? If not, we can take is over.

@qingyunha
Copy link
Contributor Author

Sorry for the delay. I still want to try to implement this feature, perhaps this weekend.

@SandyXSD
Copy link
Contributor

Sure

pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
@qingyunha
Copy link
Contributor Author

Updated.

go.mod Outdated Show resolved Hide resolved
pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
func (fs *fileSystem) Ioctl(cancel <-chan struct{}, in *fuse.IoctlIn, out *fuse.IoctlOut, bufIn, bufOut []byte) (status fuse.Status) {
ctx := newContext(cancel, &in.InHeader)
defer releaseContext(ctx)
out.Result = int32(fs.v.Ioctl(ctx, Ino(in.NodeId), in.Cmd, in.Arg, bufIn, bufOut))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
out.Result = int32(fs.v.Ioctl(ctx, Ino(in.NodeId), in.Cmd, in.Arg, bufIn, bufOut))
return fuse.Status(fs.v.Ioctl(ctx, Ino(in.NodeId), in.Cmd, in.Arg, bufIn, bufOut))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the ioctl result should be set to out.Result. The return error will be the fuse protocol level error.

pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
@SandyXSD
Copy link
Contributor

@qingyunha Please rebase the PR and resolve the conflicts.

@SandyXSD
Copy link
Contributor

Failed test:

 base_test.go:1570: fallocate f : operation not permitted

@qingyunha
Copy link
Contributor Author

Failed test:

 base_test.go:1570: fallocate f : operation not permitted

Done.

@SandyXSD SandyXSD merged commit 4744b0f into juicedata:main Aug 24, 2022
zhoucheng361 added a commit that referenced this pull request Aug 30, 2022
zhoucheng361 added a commit that referenced this pull request Aug 31, 2022
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.

5 participants