added a check for the nil value when requesting FindEntry. (#6651)
Co-authored-by: akosov <a.kosov@kryptonite.ru>
This commit is contained in:
@@ -3,12 +3,13 @@ package filer
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3bucket"
|
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/s3api/s3bucket"
|
||||||
|
|
||||||
"github.com/seaweedfs/seaweedfs/weed/cluster/lock_manager"
|
"github.com/seaweedfs/seaweedfs/weed/cluster/lock_manager"
|
||||||
|
|
||||||
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||||
@@ -289,7 +290,7 @@ func (f *Filer) ensureParentDirectoryEntry(ctx context.Context, entry *Entry, di
|
|||||||
glog.V(2).Infof("create directory: %s %v", dirPath, dirEntry.Mode)
|
glog.V(2).Infof("create directory: %s %v", dirPath, dirEntry.Mode)
|
||||||
mkdirErr := f.Store.InsertEntry(ctx, dirEntry)
|
mkdirErr := f.Store.InsertEntry(ctx, dirEntry)
|
||||||
if mkdirErr != nil {
|
if mkdirErr != nil {
|
||||||
if _, err := f.FindEntry(ctx, util.FullPath(dirPath)); err == filer_pb.ErrNotFound {
|
if fEntry, err := f.FindEntry(ctx, util.FullPath(dirPath)); err == filer_pb.ErrNotFound || fEntry == nil {
|
||||||
glog.V(3).Infof("mkdir %s: %v", dirPath, mkdirErr)
|
glog.V(3).Infof("mkdir %s: %v", dirPath, mkdirErr)
|
||||||
return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
|
return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user