File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -212,19 +212,17 @@ func (mf *manifestFile) addChanges(changesParam []*pb.ManifestChange) error {
212212 }
213213 // Maybe we could use O_APPEND instead (on certain file systems)
214214 mf .appendLock .Lock ()
215+ defer mf .appendLock .Unlock ()
215216 if err := applyChangeSet (& mf .manifest , & changes ); err != nil {
216- mf .appendLock .Unlock ()
217217 return err
218218 }
219219 if mf .inMemory {
220- mf .appendLock .Unlock ()
221220 return nil
222221 }
223222 // Rewrite manifest if it'd shrink by 1/10 and it's big enough to care
224223 if mf .manifest .Deletions > mf .deletionsRewriteThreshold &&
225224 mf .manifest .Deletions > manifestDeletionsRatio * (mf .manifest .Creations - mf .manifest .Deletions ) {
226225 if err := mf .rewrite (); err != nil {
227- mf .appendLock .Unlock ()
228226 return err
229227 }
230228 } else {
@@ -233,12 +231,10 @@ func (mf *manifestFile) addChanges(changesParam []*pb.ManifestChange) error {
233231 binary .BigEndian .PutUint32 (lenCrcBuf [4 :8 ], crc32 .Checksum (buf , y .CastagnoliCrcTable ))
234232 buf = append (lenCrcBuf [:], buf ... )
235233 if _ , err := mf .fp .Write (buf ); err != nil {
236- mf .appendLock .Unlock ()
237234 return err
238235 }
239236 }
240237
241- mf .appendLock .Unlock ()
242238 return syncFunc (mf .fp )
243239}
244240
You can’t perform that action at this time.
0 commit comments