Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1f01854

Browse files
committedJan 24, 2016
clean up files locking
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 41498e7 commit 1f01854

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed
 

‎core/commands/files/files.go

+1-16
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,6 @@ Warning:
501501

502502
create, _, _ := req.Option("create").Bool()
503503
trunc, _, _ := req.Option("truncate").Bool()
504-
flush, set, _ := req.Option("flush").Bool()
505-
if !set {
506-
flush = true
507-
}
508504

509505
nd, err := req.InvocContext().GetNode()
510506
if err != nil {
@@ -528,18 +524,7 @@ Warning:
528524
return
529525
}
530526

531-
if flush {
532-
defer func() {
533-
fi.Close()
534-
err := mfs.FlushPath(nd.FilesRoot, path)
535-
if err != nil {
536-
res.SetError(err, cmds.ErrNormal)
537-
return
538-
}
539-
}()
540-
} else {
541-
defer fi.Sync()
542-
}
527+
defer fi.Close()
543528

544529
if trunc {
545530
if err := fi.Truncate(0); err != nil {

‎mfs/file.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@ func (fi *File) flushUp() error {
9595
return err
9696
}
9797

98-
//name := fi.name
99-
//parent := fi.parent
98+
name := fi.name
99+
parent := fi.parent
100100

101101
// explicit unlock *only* before closeChild call
102102
fi.Unlock()
103-
return nil
104-
//return parent.closeChild(name, nd)
103+
return parent.closeChild(name, nd)
105104
}
106105

107106
// Sync flushes the changes in the file to disk

0 commit comments

Comments
 (0)
Please sign in to comment.