diff --git a/cmd/config/cache/lookup.go b/cmd/config/cache/lookup.go index 6e8ea6f2e..297bc90a4 100644 --- a/cmd/config/cache/lookup.go +++ b/cmd/config/cache/lookup.go @@ -222,6 +222,10 @@ func LookupConfig(kvs config.KVS) (Config, error) { if err != nil { return cfg, err } + if cfg.After > 0 && cfg.CommitWriteback { + err := errors.New("cache after cannot be used with commit writeback") + return cfg, config.ErrInvalidCacheSetting(err) + } } return cfg, nil diff --git a/cmd/config/errors.go b/cmd/config/errors.go index e6483cc4b..01bcf0b1a 100644 --- a/cmd/config/errors.go +++ b/cmd/config/errors.go @@ -108,6 +108,11 @@ var ( "MINIO_CACHE_COMMIT: Valid expected value is `writeback` or `writethrough`", ) + ErrInvalidCacheSetting = newErrFn( + "Incompatible cache setting", + "Please check the passed value", + "MINIO_CACHE_AFTER cannot be used with MINIO_CACHE_COMMIT setting", + ) ErrInvalidRotatingCredentialsBackendEncrypted = newErrFn( "Invalid rotating credentials", "Please set correct rotating credentials in the environment for decryption",