feat: add concurrency limiter to scoutfs

This brings scoutfs in-line with the posix concurrency limiter.
This fixes a hang with scoutfs due to not correctly initializing
the concurrency in posix leading to a concurrency of 0 allowed.

This also adds a sane default to the posix concurrency when not
initialized.
This commit is contained in:
Ben McClelland
2026-02-26 17:34:29 -08:00
parent 17b42ac5d8
commit b3eac9781f
4 changed files with 28 additions and 1 deletions
+12
View File
@@ -99,6 +99,13 @@ move interfaces as well as support for tiered filesystems.`,
EnvVars: []string{"VGW_DISABLE_NOARCHIVE"},
Destination: &disableNoArchive,
},
&cli.IntFlag{
Name: "concurrency",
Usage: "maximum concurrent actions allowed",
EnvVars: []string{"VGW_POSIX_CONCURRENCY"},
Value: 5000,
Destination: &actionsConcurrency,
},
},
}
}
@@ -112,6 +119,10 @@ func runScoutfs(ctx *cli.Context) error {
return fmt.Errorf("invalid directory permissions: %d", dirPerms)
}
if actionsConcurrency <= 0 {
return fmt.Errorf("concurrency must be positive, got %d", actionsConcurrency)
}
var opts scoutfs.ScoutfsOpts
opts.GlacierMode = glacier
opts.ChownUID = chownuid
@@ -122,6 +133,7 @@ func runScoutfs(ctx *cli.Context) error {
opts.VersioningDir = versioningDir
opts.ValidateBucketNames = disableStrictBucketNames
opts.SetProjectID = setProjectID
opts.Concurrency = actionsConcurrency
be, err := scoutfs.New(ctx.Args().Get(0), opts)
if err != nil {