mirror of
https://github.com/rclone/rclone.git
synced 2024-12-01 21:04:56 +01:00
mount, cmount: remove addition of O_CREATE to flags on file open #2141
Previously this was adding it in to all file opens which was causing inefficiencies under Windows where it stats the file using open/fstat/close. This change will make stat operations run much quicker under Windows as they won't have to open the underlying file This problem was introduced in61b6159a05336bd7ba105766de2d2ff171f7fb81 where we added O_CREATE to all file opens and creates.
This commit is contained in:
parent
0a0318df20
commit
34c45a7c04
@ -283,7 +283,7 @@ func (fsys *FS) Open(path string, flags int) (errc int, fh uint64) {
|
|||||||
defer log.Trace(path, "flags=0x%X", flags)("errc=%d, fh=0x%X", &errc, &fh)
|
defer log.Trace(path, "flags=0x%X", flags)("errc=%d, fh=0x%X", &errc, &fh)
|
||||||
|
|
||||||
// translate the fuse flags to os flags
|
// translate the fuse flags to os flags
|
||||||
flags = translateOpenFlags(flags) | os.O_CREATE
|
flags = translateOpenFlags(flags)
|
||||||
handle, err := fsys.VFS.OpenFile(path, flags, 0777)
|
handle, err := fsys.VFS.OpenFile(path, flags, 0777)
|
||||||
if errc != 0 {
|
if errc != 0 {
|
||||||
return translateError(err), fhUnset
|
return translateError(err), fhUnset
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
@ -69,10 +68,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
|
|||||||
|
|
||||||
// fuse flags are based off syscall flags as are os flags, so
|
// fuse flags are based off syscall flags as are os flags, so
|
||||||
// should be compatible
|
// should be compatible
|
||||||
//
|
handle, err := f.File.Open(int(req.Flags))
|
||||||
// we seem to be missing O_CREATE here so add it in to allow
|
|
||||||
// file creation
|
|
||||||
handle, err := f.File.Open(int(req.Flags) | os.O_CREATE)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, translateError(err)
|
return nil, translateError(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user