diff options
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/command/filer_copy.go | 4 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write_autochunk.go | 6 | ||||
| -rw-r--r-- | weed/storage/disk_location.go | 12 |
3 files changed, 14 insertions, 8 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index cc356de88..1b5f4c849 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -159,7 +159,7 @@ func runCopy(cmd *Command, args []string) bool { defer close(fileCopyTaskChan) for _, fileOrDir := range fileOrDirs { if err := genFileCopyTask(fileOrDir, urlPath, fileCopyTaskChan); err != nil { - fmt.Fprintf(os.Stderr, "gen file list error: %v\n", err) + fmt.Fprintf(os.Stderr, "genFileCopyTask : %v\n", err) break } } @@ -202,7 +202,7 @@ func genFileCopyTask(fileOrDir string, destPath string, fileCopyTaskChan chan Fi fi, err := os.Stat(fileOrDir) if err != nil { - fmt.Fprintf(os.Stderr, "Failed to get stat for file %s: %v\n", fileOrDir, err) + fmt.Fprintf(os.Stderr, "Error: read file %s: %v\n", fileOrDir, err) return nil } diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index e52e20a8a..0cfbeba47 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -57,7 +57,11 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r * reply, md5bytes, err = fs.doPutAutoChunk(ctx, w, r, chunkSize, so) } if err != nil { - writeJsonError(w, r, http.StatusInternalServerError, err) + if strings.HasPrefix(err.Error(), "read input:") { + writeJsonError(w, r, 499, err) + } else { + writeJsonError(w, r, http.StatusInternalServerError, err) + } } else if reply != nil { if len(md5bytes) > 0 { w.Header().Set("Content-MD5", util.Base64Encode(md5bytes)) diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index 7030900dc..c6619b260 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -101,12 +101,14 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne } // avoid loading one volume more than once - l.volumesLock.RLock() - _, found := l.volumes[vid] - l.volumesLock.RUnlock() - if found { + l.volumesLock.Lock() + if _, found := l.volumes[vid]; found { + l.volumesLock.Unlock() glog.V(1).Infof("loaded volume, %v", vid) return true + } else { + l.volumes[vid] = nil + l.volumesLock.Unlock() } // load the volume @@ -115,7 +117,7 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne glog.V(0).Infof("new volume %s error %s", volumeName, e) return false } - + l.SetVolume(vid, v) size, _, _ := v.FileStat() |
