aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-03-08 23:02:30 -0800
committerchrislu <chris.lu@gmail.com>2022-03-08 23:02:30 -0800
commitdc204dd13700c1800a830a41fb22f10ab88fddb4 (patch)
tree3a8e184fb902481fac8b47bc443a4eaad7e57e77
parent3aeee3d748712d4c1afa5eacd4f12939f8173afa (diff)
downloadseaweedfs-dc204dd13700c1800a830a41fb22f10ab88fddb4.tar.xz
seaweedfs-dc204dd13700c1800a830a41fb22f10ab88fddb4.zip
fix nil entry
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1d340b4] goroutine 130523 [running]: github.com/chrislusf/seaweedfs/weed/filer.FileSize(...) /code/seaweedfs/weed/filer/filechunks.go:26 github.com/chrislusf/seaweedfs/weed/mount.(*WFS).Lookup(0xc000866d80, 0x1, 0xc002897f40, {0xc004b00980, 0x39}, 0x1ec19e0) /code/seaweedfs/weed/mount/weedfs_dir_lookup.go:59 +0x654 github.com/hanwen/go-fuse/v2/fuse.doLookup(0xc00033c000, 0xc00033c000) /code/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.1.0/fuse/opcode.go:333 +0x6b github.com/hanwen/go-fuse/v2/fuse.(*Server).handleRequest(0xc000ab2420, 0xc00033c000) /code/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.1.0/fuse/server.go:483 +0x1f3 github.com/hanwen/go-fuse/v2/fuse.(*Server).loop(0xc000ab2420, 0x0) /code/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.1.0/fuse/server.go:456 +0x110 created by github.com/hanwen/go-fuse/v2/fuse.(*Server).readRequest /code/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.1.0/fuse/server.go:323 +0x534
-rw-r--r--weed/mount/weedfs_dir_lookup.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/weed/mount/weedfs_dir_lookup.go b/weed/mount/weedfs_dir_lookup.go
index 7f2821a94..02fc9f0d8 100644
--- a/weed/mount/weedfs_dir_lookup.go
+++ b/weed/mount/weedfs_dir_lookup.go
@@ -55,7 +55,7 @@ func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name strin
inode := wfs.inodeToPath.Lookup(fullFilePath, localEntry.Mode, len(localEntry.HardLinkId) > 0, localEntry.Inode, true)
- if fh, found := wfs.fhmap.FindFileHandle(inode); found {
+ if fh, found := wfs.fhmap.FindFileHandle(inode); found && fh.entry != nil {
glog.V(4).Infof("lookup opened file %s size %d", dirPath.Child(localEntry.Name()), filer.FileSize(fh.entry))
localEntry = filer.FromPbEntry(string(dirPath), fh.entry)
}