Browse Source
Skip parent directory creation in mount (#4310 )
A POSIX filesystem does not implicitly create parent directories when
they do not exist. Directories must be explicitly created and
permissions be set.
This also fixes a bug where asynchronous operations would create a
file in the filer before the parent directory was created. If the
file was a symlink or another special type of file the directory
would inherit that type and become unusable in the mounted FS.
pull/4313/head
Patrick Schmidt
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
23 additions and
14 deletions
weed/mount/weedfs_dir_mkrm.go
weed/mount/weedfs_link.go
weed/mount/weedfs_symlink.go
@ -3,14 +3,16 @@ package mount
import (
import (
"context"
"context"
"fmt"
"fmt"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"os"
"os"
"strings"
"strings"
"syscall"
"syscall"
"time"
"time"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
)
)
/ * * Create a directory
/ * * Create a directory
@ -57,6 +59,7 @@ func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out
Directory : string ( dirFullPath ) ,
Directory : string ( dirFullPath ) ,
Entry : newEntry ,
Entry : newEntry ,
Signatures : [ ] int32 { wfs . signature } ,
Signatures : [ ] int32 { wfs . signature } ,
SkipCheckParentDirectory : true ,
}
}
glog . V ( 1 ) . Infof ( "mkdir: %v" , request )
glog . V ( 1 ) . Infof ( "mkdir: %v" , request )
@ -2,12 +2,14 @@ package mount
import (
import (
"context"
"context"
"syscall"
"time"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"syscall"
"time"
)
)
/ *
/ *
@ -73,6 +75,7 @@ func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *
HardLinkCounter : oldEntry . HardLinkCounter ,
HardLinkCounter : oldEntry . HardLinkCounter ,
} ,
} ,
Signatures : [ ] int32 { wfs . signature } ,
Signatures : [ ] int32 { wfs . signature } ,
SkipCheckParentDirectory : true ,
}
}
// apply changes to the filer, and also apply to local metaCache
// apply changes to the filer, and also apply to local metaCache
@ -3,13 +3,15 @@ package mount
import (
import (
"context"
"context"
"fmt"
"fmt"
"os"
"syscall"
"time"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"os"
"syscall"
"time"
)
)
/** Create a symbolic link */
/** Create a symbolic link */
@ -43,6 +45,7 @@ func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target st
} ,
} ,
} ,
} ,
Signatures : [ ] int32 { wfs . signature } ,
Signatures : [ ] int32 { wfs . signature } ,
SkipCheckParentDirectory : true ,
}
}
err := wfs . WithFilerClient ( false , func ( client filer_pb . SeaweedFilerClient ) error {
err := wfs . WithFilerClient ( false , func ( client filer_pb . SeaweedFilerClient ) error {