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

mount: recovery read only file handler #4524

Merged
merged 14 commits into from
Mar 20, 2024
Prev Previous commit
Next Next commit
adjust
zhijian-pro committed Mar 15, 2024
commit f727feb9073b4f1bad20f2a3826910d8c679f7ab
2 changes: 1 addition & 1 deletion pkg/vfs/handle.go
Original file line number Diff line number Diff line change
@@ -231,7 +231,7 @@ func (v *VFS) releaseHandle(inode Ino, fh uint64) {
}

func (v *VFS) newFileHandle(inode Ino, length uint64, flags uint32) uint64 {
h := v.newHandle(inode, (flags&syscall.O_ACCMODE) == syscall.O_RDONLY)
h := v.newHandle(inode, (flags&O_ACCMODE) == syscall.O_RDONLY)
h.Lock()
defer h.Unlock()
h.flags = flags
2 changes: 1 addition & 1 deletion pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
@@ -722,7 +722,7 @@ func (v *VFS) Read(ctx Context, ino Ino, buf []byte, off uint64, fh uint64) (n i
return
}
// there could be read operation for write-only if kernel writeback is enabled
if !v.Conf.FuseOpts.EnableWriteback && (h.flags&syscall.O_ACCMODE) != syscall.O_RDONLY {
if !v.Conf.FuseOpts.EnableWriteback && (h.flags&O_ACCMODE) != syscall.O_RDONLY {
err = syscall.EACCES
Copy link
Contributor

Choose a reason for hiding this comment

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

   EBADF  fd is not a valid file descriptor or is not open for reading.

return
}