mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-26 15:00:48 +01:00
mount: surface ENOSPC instead of endless waiting when the cluster is full (#10341)
When every volume is full, a chunk upload fails only after the assign retry budget, the failed chunk's data is dropped, and the mount kept accepting writes anyway. cp would crawl for hours pushing the rest of the file through a pipeline that could not persist it, and only close() reported an error - a generic EIO. Poison the file handle on the first failed chunk upload so subsequent writes fail immediately, and map "no writable volumes" / "no free volumes" upload errors to ENOSPC so the writing process aborts with "No space left on device". Also guard lastErr with a mutex: it was written concurrently by uploader goroutines, and keep the first error so later failures do not mask the root cause.
This commit is contained in:
1 parent
25ab4c3cac
commit
5553e7b876
7 files changed
+117
-6
No files matched your search
@@ -48,6 +48,28 @@ func grpcErrorToFuseStatus(err error) fuse.Status {
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
// isStorageFullError reports whether a chunk upload failed because the cluster
|
||||
// has no writable volume left (disks full and volume growth failed). The
|
||||
// master's message reaches the mount as plain text inside
|
||||
// AssignVolumeResponse.Error, so match on text rather than a status code.
|
||||
func isStorageFullError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
errStr := strings.ToLower(err.Error())
|
||||
return strings.Contains(errStr, "no writable volumes") ||
|
||||
strings.Contains(errStr, "no free volumes")
|
||||
}
|
||||
|
||||
// writeErrorToFuseStatus maps a dirty-page write/flush failure to the status
|
||||
// returned to the kernel: ENOSPC when the cluster is out of space, EIO otherwise.
|
||||
func writeErrorToFuseStatus(err error) fuse.Status {
|
||||
if isStorageFullError(err) {
|
||||
return fuse.Status(syscall.ENOSPC)
|
||||
}
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
// isRetryableFilerError reports whether a filer RPC error looks transient
|
||||
// enough to retry. It takes a conservative whitelist approach: only errors
|
||||
// that clearly describe a permanent application-level failure
|
||||
|
||||
Reference in new issue
Block a user