Skip to content

Commit 3191dad

Browse files
committed
Remove --precondition-errors flag
1 parent 06b1ea0 commit 3191dad

File tree

13 files changed

+44
-97
lines changed

13 files changed

+44
-97
lines changed

cfg/config.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,6 @@ type FileSystemConfig struct {
541541

542542
MaxReadAheadKb int64 `yaml:"max-read-ahead-kb"`
543543

544-
PreconditionErrors bool `yaml:"precondition-errors"`
545-
546544
RenameDirLimit int64 `yaml:"rename-dir-limit"`
547545

548546
TempDir ResolvedPath `yaml:"temp-dir"`
@@ -1226,12 +1224,6 @@ func BuildFlagSet(flagSet *pflag.FlagSet) error {
12261224

12271225
flagSet.StringP("only-dir", "", "", "Mount only a specific directory within the bucket. See docs/mounting for more information")
12281226

1229-
flagSet.BoolP("precondition-errors", "", true, "Throw Stale NFS file handle error in case the object being synced or read from is modified by some other concurrent process. This helps prevent silent data loss or data corruption.")
1230-
1231-
if err := flagSet.MarkHidden("precondition-errors"); err != nil {
1232-
return err
1233-
}
1234-
12351227
flagSet.StringP("profile", "", "", "The name of the profile to apply. e.g. aiml-training, aiml-serving, aiml-checkpointing")
12361228

12371229
flagSet.IntP("prometheus-port", "", 0, "Expose Prometheus metrics endpoint on this port and a path of /metrics.")
@@ -1829,10 +1821,6 @@ func BindFlags(v *viper.Viper, flagSet *pflag.FlagSet) error {
18291821
return err
18301822
}
18311823

1832-
if err := v.BindPFlag("file-system.precondition-errors", flagSet.Lookup("precondition-errors")); err != nil {
1833-
return err
1834-
}
1835-
18361824
if err := v.BindPFlag("profile", flagSet.Lookup("profile")); err != nil {
18371825
return err
18381826
}

cfg/params.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -518,16 +518,6 @@ params:
518518
- bucket-type: "zonal"
519519
value: 16384 # 16 MiB
520520

521-
- config-path: "file-system.precondition-errors"
522-
flag-name: "precondition-errors"
523-
type: "bool"
524-
usage: >-
525-
Throw Stale NFS file handle error in case the object being synced or read
526-
from is modified by some other concurrent process. This helps prevent
527-
silent data loss or data corruption.
528-
hide-flag: true
529-
default: true
530-
531521
- config-path: "file-system.rename-dir-limit"
532522
flag-name: "rename-dir-limit"
533523
type: "int"

cmd/config_validation_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,6 @@ func TestValidateConfigFile_FileSystemConfigSuccessful(t *testing.T) {
598598
InactiveMrdCacheSize: 1000,
599599
RenameDirLimit: 0,
600600
TempDir: "",
601-
PreconditionErrors: true,
602601
Uid: -1,
603602
MaxReadAheadKb: 0,
604603
},
@@ -619,7 +618,6 @@ func TestValidateConfigFile_FileSystemConfigSuccessful(t *testing.T) {
619618
InactiveMrdCacheSize: 1000,
620619
RenameDirLimit: 0,
621620
TempDir: "",
622-
PreconditionErrors: true,
623621
Uid: -1,
624622
MaxReadAheadKb: 0,
625623
},
@@ -640,7 +638,6 @@ func TestValidateConfigFile_FileSystemConfigSuccessful(t *testing.T) {
640638
InactiveMrdCacheSize: 1000,
641639
RenameDirLimit: 10,
642640
TempDir: cfg.ResolvedPath(path.Join(hd, "temp")),
643-
PreconditionErrors: false,
644641
Uid: 8,
645642
MaxReadAheadKb: 1024,
646643
},

cmd/root_test.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
946946
InactiveMrdCacheSize: 1000,
947947
RenameDirLimit: 0,
948948
TempDir: "",
949-
PreconditionErrors: true,
950949
ExperimentalODirect: false,
951950
Uid: -1,
952951
}
@@ -964,7 +963,7 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
964963
}{
965964
{
966965
name: "normal",
967-
args: []string{"gcsfuse", "--dir-mode=0777", "--disable-parallel-dirops", "--experimental-enable-dentry-cache", "--experimental-enable-readdirplus", "--file-mode=0666", "--o", "ro", "--gid=7", "--ignore-interrupts=false", "--kernel-list-cache-ttl-secs=300", "--rename-dir-limit=10", "--temp-dir=~/temp", "--uid=8", "--precondition-errors=false", "abc", "pqr"},
966+
args: []string{"gcsfuse", "--dir-mode=0777", "--disable-parallel-dirops", "--experimental-enable-dentry-cache", "--experimental-enable-readdirplus", "--file-mode=0666", "--o", "ro", "--gid=7", "--ignore-interrupts=false", "--kernel-list-cache-ttl-secs=300", "--rename-dir-limit=10", "--temp-dir=~/temp", "--uid=8", "abc", "pqr"},
968967
expectedConfig: &cfg.Config{
969968
FileSystem: cfg.FileSystemConfig{
970969
DirMode: 0777,
@@ -979,7 +978,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
979978
InactiveMrdCacheSize: 1000,
980979
RenameDirLimit: 10,
981980
TempDir: cfg.ResolvedPath(path.Join(hd, "temp")),
982-
PreconditionErrors: false,
983981
ExperimentalODirect: false,
984982
Uid: 8,
985983
},
@@ -1002,7 +1000,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
10021000
InactiveMrdCacheSize: 1000,
10031001
RenameDirLimit: 0,
10041002
TempDir: "",
1005-
PreconditionErrors: true,
10061003
ExperimentalODirect: false,
10071004
Uid: -1,
10081005
},
@@ -1025,7 +1022,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
10251022
InactiveMrdCacheSize: 1000,
10261023
RenameDirLimit: 200000,
10271024
TempDir: "",
1028-
PreconditionErrors: true,
10291025
ExperimentalODirect: false,
10301026
Uid: -1,
10311027
},
@@ -1050,7 +1046,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
10501046
InactiveMrdCacheSize: 1000,
10511047
RenameDirLimit: 0,
10521048
TempDir: "",
1053-
PreconditionErrors: true,
10541049
ExperimentalODirect: false,
10551050
Uid: -1,
10561051
},
@@ -1075,7 +1070,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
10751070
InactiveMrdCacheSize: 1000,
10761071
RenameDirLimit: 15000,
10771072
TempDir: "",
1078-
PreconditionErrors: true,
10791073
ExperimentalODirect: false,
10801074
Uid: -1,
10811075
},
@@ -1150,7 +1144,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
11501144
IgnoreInterrupts: true,
11511145
InactiveMrdCacheSize: 1000,
11521146
ExperimentalODirect: true,
1153-
PreconditionErrors: true,
11541147
Uid: -1,
11551148
},
11561149
},
@@ -1167,7 +1160,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
11671160
IgnoreInterrupts: true,
11681161
InactiveMrdCacheSize: 1000,
11691162
ExperimentalODirect: false,
1170-
PreconditionErrors: true,
11711163
Uid: -1,
11721164
MaxReadAheadKb: 1024,
11731165
},
@@ -1184,7 +1176,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
11841176
Gid: -1,
11851177
IgnoreInterrupts: true,
11861178
InactiveMrdCacheSize: 1000,
1187-
PreconditionErrors: true,
11881179
Uid: -1,
11891180
MaxReadAheadKb: 0,
11901181
},
@@ -1202,7 +1193,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12021193
IgnoreInterrupts: true,
12031194
InactiveMrdCacheSize: 1000,
12041195
ExperimentalODirect: false,
1205-
PreconditionErrors: true,
12061196
Uid: -1,
12071197
MaxBackground: 512,
12081198
},
@@ -1220,7 +1210,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12201210
IgnoreInterrupts: true,
12211211
InactiveMrdCacheSize: 1000,
12221212
ExperimentalODirect: false,
1223-
PreconditionErrors: true,
12241213
Uid: -1,
12251214
MaxBackground: 0,
12261215
},
@@ -1238,7 +1227,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12381227
IgnoreInterrupts: true,
12391228
InactiveMrdCacheSize: 1000,
12401229
ExperimentalODirect: false,
1241-
PreconditionErrors: true,
12421230
Uid: -1,
12431231
CongestionThreshold: 256,
12441232
},
@@ -1256,7 +1244,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12561244
IgnoreInterrupts: true,
12571245
InactiveMrdCacheSize: 1000,
12581246
ExperimentalODirect: false,
1259-
PreconditionErrors: true,
12601247
Uid: -1,
12611248
CongestionThreshold: 0,
12621249
},
@@ -1274,7 +1261,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12741261
IgnoreInterrupts: true,
12751262
InactiveMrdCacheSize: 1000,
12761263
ExperimentalODirect: false,
1277-
PreconditionErrors: true,
12781264
Uid: -1,
12791265
EnableKernelReader: true,
12801266
},
@@ -1292,7 +1278,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
12921278
IgnoreInterrupts: true,
12931279
InactiveMrdCacheSize: 1000,
12941280
ExperimentalODirect: false,
1295-
PreconditionErrors: true,
12961281
Uid: -1,
12971282
EnableKernelReader: false,
12981283
},
@@ -1310,7 +1295,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
13101295
IgnoreInterrupts: true,
13111296
InactiveMrdCacheSize: 1000,
13121297
ExperimentalODirect: false,
1313-
PreconditionErrors: true,
13141298
Uid: -1,
13151299
KernelParamsFile: "/tmp/params",
13161300
},
@@ -1328,7 +1312,6 @@ func TestArgsParsing_FileSystemFlags(t *testing.T) {
13281312
IgnoreInterrupts: true,
13291313
InactiveMrdCacheSize: 1000,
13301314
ExperimentalODirect: false,
1331-
PreconditionErrors: true,
13321315
Uid: -1,
13331316
KernelParamsFile: "/tmp/config_params",
13341317
},

cmd/testdata/valid_config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ file-system:
6666
kernel-list-cache-ttl-secs: 300
6767
rename-dir-limit: 10
6868
temp-dir: ~/temp
69-
precondition-errors: false
7069
max-read-ahead-kb: 1024
7170
list:
7271
enable-empty-managed-folders: true

internal/fs/fs_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ func (t *fsTest) SetUpTestSuite() {
171171
TtlSecs: 60,
172172
TypeCacheMaxSizeMb: 4,
173173
},
174-
FileSystem: cfg.FileSystemConfig{
175-
PreconditionErrors: false,
176-
},
177174
EnableNewReader: true,
178175
}
179176
}

internal/fs/local_modifications_test.go

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,9 @@ func (t *FileTest) UnlinkFile_StillOpen() {
18871887
// Create and open a file.
18881888
f, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0600)
18891889
AssertEq(nil, err)
1890-
defer f.Close()
1890+
defer func() {
1891+
_ = f.Close()
1892+
}()
18911893

18921894
// Write some data into it.
18931895
n, err := f.Write([]byte("taco"))
@@ -2049,7 +2051,9 @@ func (t *FileTest) Chtimes_OpenFile_Clean() {
20492051
// Open it for reading.
20502052
f, err := os.Open(p)
20512053
AssertEq(nil, err)
2052-
defer f.Close()
2054+
defer func() {
2055+
_ = f.Close()
2056+
}()
20532057

20542058
// Change its mtime.
20552059
newMtime := time.Date(2012, 8, 15, 22, 56, 0, 0, time.Local)
@@ -2082,7 +2086,9 @@ func (t *FileTest) Chtimes_OpenFile_Dirty() {
20822086
p := path.Join(mntDir, "foo")
20832087
f, err := os.Create(p)
20842088
AssertEq(nil, err)
2085-
defer f.Close()
2089+
defer func() {
2090+
_ = f.Close()
2091+
}()
20862092

20872093
// Dirty the file.
20882094
_, err = f.Write([]byte("taco"))
@@ -2171,11 +2177,14 @@ func (t *FileTest) Sync_Clobbered() {
21712177
var n int
21722178

21732179
// Create a file.
2174-
t.f1, err = os.Create(path.Join(mntDir, "foo"))
2180+
f, err := os.Create(path.Join(mntDir, "foo"))
21752181
AssertEq(nil, err)
2182+
defer func() {
2183+
_ = f.Close()
2184+
}()
21762185

21772186
// Dirty the file by giving it some contents.
2178-
n, err = t.f1.Write([]byte("taco"))
2187+
n, err = f.Write([]byte("taco"))
21792188
AssertEq(nil, err)
21802189
AssertEq(4, n)
21812190

@@ -2192,9 +2201,9 @@ func (t *FileTest) Sync_Clobbered() {
21922201
// decided to hold back the writes from above until now (in which case the
21932202
// inode will fail to load the source object), or it may fail silently.
21942203
// Either way, this should not result in a new generation being created.
2195-
err = t.f1.Sync()
2204+
err = f.Sync()
21962205
if err != nil {
2197-
ExpectThat(err, Error(HasSubstr("input/output error")))
2206+
ExpectTrue(errors.Is(err, syscall.ESTALE), "err: %v", err)
21982207
}
21992208

22002209
contents, err := storageutil.ReadObject(ctx, bucket, "foo")
@@ -2253,7 +2262,9 @@ func (t *FileTest) Close_Clobbered() {
22532262
// Create a file.
22542263
f, err := os.Create(path.Join(mntDir, "foo"))
22552264
AssertEq(nil, err)
2256-
defer f.Close()
2265+
defer func() {
2266+
_ = f.Close()
2267+
}()
22572268

22582269
// Dirty the file by giving it some contents.
22592270
n, err = f.Write([]byte("taco"))
@@ -2273,7 +2284,7 @@ func (t *FileTest) Close_Clobbered() {
22732284
// faulting in the object's contents on Linux where close may cause cached
22742285
// writes to be delivered to the file system. But in any case the new
22752286
// generation should not be replaced.
2276-
f.Close()
2287+
_ = f.Close()
22772288

22782289
contents, err := storageutil.ReadObject(ctx, bucket, "foo")
22792290
AssertEq(nil, err)
@@ -2716,7 +2727,9 @@ func (t *RenameTest) IntoFileSystem() {
27162727
// Create a file outside of our file system.
27172728
f, err := os.CreateTemp("", "memfs_test")
27182729
AssertEq(nil, err)
2719-
defer f.Close()
2730+
defer func() {
2731+
_ = f.Close()
2732+
}()
27202733

27212734
oldPath := f.Name()
27222735
defer os.Remove(oldPath)

internal/fs/notifier_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func (t *NotifierTest) SetupSuite() {
4747
t.serverCfg.NewConfig = &cfg.Config{
4848
FileSystem: cfg.FileSystemConfig{
4949
ExperimentalEnableDentryCache: true,
50-
PreconditionErrors: true,
5150
},
5251
Write: cfg.WriteConfig{
5352
EnableStreamingWrites: true,

internal/fs/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewServer(ctx context.Context, cfg *ServerConfig) (fuse.Server, error) {
3131
return nil, fmt.Errorf("create file system: %w", err)
3232
}
3333

34-
fs = wrappers.WithErrorMapping(fs, cfg.NewConfig.FileSystem.PreconditionErrors)
34+
fs = wrappers.WithErrorMapping(fs)
3535
if newcfg.IsTracingEnabled(cfg.NewConfig) {
3636
fs = wrappers.WithTracing(fs, cfg.TraceHandle)
3737
}

internal/fs/stale_file_handle_common_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ type staleFileHandleCommon struct {
4343

4444
func commonServerConfig() *cfg.Config {
4545
return &cfg.Config{
46-
FileSystem: cfg.FileSystemConfig{
47-
PreconditionErrors: true,
48-
},
46+
FileSystem: cfg.FileSystemConfig{},
4947
MetadataCache: cfg.MetadataCacheConfig{
5048
TtlSecs: 0,
5149
},

0 commit comments

Comments
 (0)