legacy.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. package hcsshim
  2. import (
  3. "bufio"
  4. "encoding/binary"
  5. "errors"
  6. "fmt"
  7. "io"
  8. "os"
  9. "path/filepath"
  10. "strings"
  11. "syscall"
  12. "github.com/Microsoft/go-winio"
  13. )
  14. var errorIterationCanceled = errors.New("")
  15. var mutatedUtilityVMFiles = map[string]bool{
  16. `EFI\Microsoft\Boot\BCD`: true,
  17. `EFI\Microsoft\Boot\BCD.LOG`: true,
  18. `EFI\Microsoft\Boot\BCD.LOG1`: true,
  19. `EFI\Microsoft\Boot\BCD.LOG2`: true,
  20. }
  21. const (
  22. filesPath = `Files`
  23. hivesPath = `Hives`
  24. utilityVMPath = `UtilityVM`
  25. utilityVMFilesPath = `UtilityVM\Files`
  26. )
  27. func openFileOrDir(path string, mode uint32, createDisposition uint32) (file *os.File, err error) {
  28. return winio.OpenForBackup(path, mode, syscall.FILE_SHARE_READ, createDisposition)
  29. }
  30. func makeLongAbsPath(path string) (string, error) {
  31. if strings.HasPrefix(path, `\\?\`) || strings.HasPrefix(path, `\\.\`) {
  32. return path, nil
  33. }
  34. if !filepath.IsAbs(path) {
  35. absPath, err := filepath.Abs(path)
  36. if err != nil {
  37. return "", err
  38. }
  39. path = absPath
  40. }
  41. if strings.HasPrefix(path, `\\`) {
  42. return `\\?\UNC\` + path[2:], nil
  43. }
  44. return `\\?\` + path, nil
  45. }
  46. func hasPathPrefix(p, prefix string) bool {
  47. return strings.HasPrefix(p, prefix) && len(p) > len(prefix) && p[len(prefix)] == '\\'
  48. }
  49. type fileEntry struct {
  50. path string
  51. fi os.FileInfo
  52. err error
  53. }
  54. type legacyLayerReader struct {
  55. root string
  56. result chan *fileEntry
  57. proceed chan bool
  58. currentFile *os.File
  59. backupReader *winio.BackupFileReader
  60. }
  61. // newLegacyLayerReader returns a new LayerReader that can read the Windows
  62. // container layer transport format from disk.
  63. func newLegacyLayerReader(root string) *legacyLayerReader {
  64. r := &legacyLayerReader{
  65. root: root,
  66. result: make(chan *fileEntry),
  67. proceed: make(chan bool),
  68. }
  69. go r.walk()
  70. return r
  71. }
  72. func readTombstones(path string) (map[string]([]string), error) {
  73. tf, err := os.Open(filepath.Join(path, "tombstones.txt"))
  74. if err != nil {
  75. return nil, err
  76. }
  77. defer tf.Close()
  78. s := bufio.NewScanner(tf)
  79. if !s.Scan() || s.Text() != "\xef\xbb\xbfVersion 1.0" {
  80. return nil, errors.New("Invalid tombstones file")
  81. }
  82. ts := make(map[string]([]string))
  83. for s.Scan() {
  84. t := filepath.Join(filesPath, s.Text()[1:]) // skip leading `\`
  85. dir := filepath.Dir(t)
  86. ts[dir] = append(ts[dir], t)
  87. }
  88. if err = s.Err(); err != nil {
  89. return nil, err
  90. }
  91. return ts, nil
  92. }
  93. func (r *legacyLayerReader) walkUntilCancelled() error {
  94. root, err := makeLongAbsPath(r.root)
  95. if err != nil {
  96. return err
  97. }
  98. r.root = root
  99. ts, err := readTombstones(r.root)
  100. if err != nil {
  101. return err
  102. }
  103. err = filepath.Walk(r.root, func(path string, info os.FileInfo, err error) error {
  104. if err != nil {
  105. return err
  106. }
  107. if path == r.root || path == filepath.Join(r.root, "tombstones.txt") || strings.HasSuffix(path, ".$wcidirs$") {
  108. return nil
  109. }
  110. r.result <- &fileEntry{path, info, nil}
  111. if !<-r.proceed {
  112. return errorIterationCanceled
  113. }
  114. // List all the tombstones.
  115. if info.IsDir() {
  116. relPath, err := filepath.Rel(r.root, path)
  117. if err != nil {
  118. return err
  119. }
  120. if dts, ok := ts[relPath]; ok {
  121. for _, t := range dts {
  122. r.result <- &fileEntry{filepath.Join(r.root, t), nil, nil}
  123. if !<-r.proceed {
  124. return errorIterationCanceled
  125. }
  126. }
  127. }
  128. }
  129. return nil
  130. })
  131. if err == errorIterationCanceled {
  132. return nil
  133. }
  134. if err == nil {
  135. return io.EOF
  136. }
  137. return err
  138. }
  139. func (r *legacyLayerReader) walk() {
  140. defer close(r.result)
  141. if !<-r.proceed {
  142. return
  143. }
  144. err := r.walkUntilCancelled()
  145. if err != nil {
  146. for {
  147. r.result <- &fileEntry{err: err}
  148. if !<-r.proceed {
  149. return
  150. }
  151. }
  152. }
  153. }
  154. func (r *legacyLayerReader) reset() {
  155. if r.backupReader != nil {
  156. r.backupReader.Close()
  157. r.backupReader = nil
  158. }
  159. if r.currentFile != nil {
  160. r.currentFile.Close()
  161. r.currentFile = nil
  162. }
  163. }
  164. func findBackupStreamSize(r io.Reader) (int64, error) {
  165. br := winio.NewBackupStreamReader(r)
  166. for {
  167. hdr, err := br.Next()
  168. if err != nil {
  169. if err == io.EOF {
  170. err = nil
  171. }
  172. return 0, err
  173. }
  174. if hdr.Id == winio.BackupData {
  175. return hdr.Size, nil
  176. }
  177. }
  178. }
  179. func (r *legacyLayerReader) Next() (path string, size int64, fileInfo *winio.FileBasicInfo, err error) {
  180. r.reset()
  181. r.proceed <- true
  182. fe := <-r.result
  183. if fe == nil {
  184. err = errors.New("LegacyLayerReader closed")
  185. return
  186. }
  187. if fe.err != nil {
  188. err = fe.err
  189. return
  190. }
  191. path, err = filepath.Rel(r.root, fe.path)
  192. if err != nil {
  193. return
  194. }
  195. if fe.fi == nil {
  196. // This is a tombstone. Return a nil fileInfo.
  197. return
  198. }
  199. if fe.fi.IsDir() && hasPathPrefix(path, filesPath) {
  200. fe.path += ".$wcidirs$"
  201. }
  202. f, err := openFileOrDir(fe.path, syscall.GENERIC_READ, syscall.OPEN_EXISTING)
  203. if err != nil {
  204. return
  205. }
  206. defer func() {
  207. if f != nil {
  208. f.Close()
  209. }
  210. }()
  211. fileInfo, err = winio.GetFileBasicInfo(f)
  212. if err != nil {
  213. return
  214. }
  215. if !hasPathPrefix(path, filesPath) {
  216. size = fe.fi.Size()
  217. r.backupReader = winio.NewBackupFileReader(f, false)
  218. if path == hivesPath || path == filesPath {
  219. // The Hives directory has a non-deterministic file time because of the
  220. // nature of the import process. Use the times from System_Delta.
  221. var g *os.File
  222. g, err = os.Open(filepath.Join(r.root, hivesPath, `System_Delta`))
  223. if err != nil {
  224. return
  225. }
  226. attr := fileInfo.FileAttributes
  227. fileInfo, err = winio.GetFileBasicInfo(g)
  228. g.Close()
  229. if err != nil {
  230. return
  231. }
  232. fileInfo.FileAttributes = attr
  233. }
  234. // The creation time and access time get reset for files outside of the Files path.
  235. fileInfo.CreationTime = fileInfo.LastWriteTime
  236. fileInfo.LastAccessTime = fileInfo.LastWriteTime
  237. } else {
  238. // The file attributes are written before the backup stream.
  239. var attr uint32
  240. err = binary.Read(f, binary.LittleEndian, &attr)
  241. if err != nil {
  242. return
  243. }
  244. fileInfo.FileAttributes = uintptr(attr)
  245. beginning := int64(4)
  246. // Find the accurate file size.
  247. if !fe.fi.IsDir() {
  248. size, err = findBackupStreamSize(f)
  249. if err != nil {
  250. err = &os.PathError{Op: "findBackupStreamSize", Path: fe.path, Err: err}
  251. return
  252. }
  253. }
  254. // Return back to the beginning of the backup stream.
  255. _, err = f.Seek(beginning, 0)
  256. if err != nil {
  257. return
  258. }
  259. }
  260. r.currentFile = f
  261. f = nil
  262. return
  263. }
  264. func (r *legacyLayerReader) Read(b []byte) (int, error) {
  265. if r.backupReader == nil {
  266. if r.currentFile == nil {
  267. return 0, io.EOF
  268. }
  269. return r.currentFile.Read(b)
  270. }
  271. return r.backupReader.Read(b)
  272. }
  273. func (r *legacyLayerReader) Close() error {
  274. r.proceed <- false
  275. <-r.result
  276. r.reset()
  277. return nil
  278. }
  279. type pendingLink struct {
  280. Path, Target string
  281. }
  282. type legacyLayerWriter struct {
  283. root string
  284. parentRoots []string
  285. destRoot string
  286. currentFile *os.File
  287. backupWriter *winio.BackupFileWriter
  288. tombstones []string
  289. pathFixed bool
  290. HasUtilityVM bool
  291. uvmDi []dirInfo
  292. addedFiles map[string]bool
  293. PendingLinks []pendingLink
  294. }
  295. // newLegacyLayerWriter returns a LayerWriter that can write the contaler layer
  296. // transport format to disk.
  297. func newLegacyLayerWriter(root string, parentRoots []string, destRoot string) *legacyLayerWriter {
  298. return &legacyLayerWriter{
  299. root: root,
  300. parentRoots: parentRoots,
  301. destRoot: destRoot,
  302. addedFiles: make(map[string]bool),
  303. }
  304. }
  305. func (w *legacyLayerWriter) init() error {
  306. if !w.pathFixed {
  307. path, err := makeLongAbsPath(w.root)
  308. if err != nil {
  309. return err
  310. }
  311. for i, p := range w.parentRoots {
  312. w.parentRoots[i], err = makeLongAbsPath(p)
  313. if err != nil {
  314. return err
  315. }
  316. }
  317. destPath, err := makeLongAbsPath(w.destRoot)
  318. if err != nil {
  319. return err
  320. }
  321. w.root = path
  322. w.destRoot = destPath
  323. w.pathFixed = true
  324. }
  325. return nil
  326. }
  327. func (w *legacyLayerWriter) initUtilityVM() error {
  328. if !w.HasUtilityVM {
  329. err := os.Mkdir(filepath.Join(w.destRoot, utilityVMPath), 0)
  330. if err != nil {
  331. return err
  332. }
  333. // Server 2016 does not support multiple layers for the utility VM, so
  334. // clone the utility VM from the parent layer into this layer. Use hard
  335. // links to avoid unnecessary copying, since most of the files are
  336. // immutable.
  337. err = cloneTree(filepath.Join(w.parentRoots[0], utilityVMFilesPath), filepath.Join(w.destRoot, utilityVMFilesPath), mutatedUtilityVMFiles)
  338. if err != nil {
  339. return fmt.Errorf("cloning the parent utility VM image failed: %s", err)
  340. }
  341. w.HasUtilityVM = true
  342. }
  343. return nil
  344. }
  345. func (w *legacyLayerWriter) reset() {
  346. if w.backupWriter != nil {
  347. w.backupWriter.Close()
  348. w.backupWriter = nil
  349. }
  350. if w.currentFile != nil {
  351. w.currentFile.Close()
  352. w.currentFile = nil
  353. }
  354. }
  355. // copyFileWithMetadata copies a file using the backup/restore APIs in order to preserve metadata
  356. func copyFileWithMetadata(srcPath, destPath string, isDir bool) (fileInfo *winio.FileBasicInfo, err error) {
  357. createDisposition := uint32(syscall.CREATE_NEW)
  358. if isDir {
  359. err = os.Mkdir(destPath, 0)
  360. if err != nil {
  361. return nil, err
  362. }
  363. createDisposition = syscall.OPEN_EXISTING
  364. }
  365. src, err := openFileOrDir(srcPath, syscall.GENERIC_READ|winio.ACCESS_SYSTEM_SECURITY, syscall.OPEN_EXISTING)
  366. if err != nil {
  367. return nil, err
  368. }
  369. defer src.Close()
  370. srcr := winio.NewBackupFileReader(src, true)
  371. defer srcr.Close()
  372. fileInfo, err = winio.GetFileBasicInfo(src)
  373. if err != nil {
  374. return nil, err
  375. }
  376. dest, err := openFileOrDir(destPath, syscall.GENERIC_READ|syscall.GENERIC_WRITE|winio.WRITE_DAC|winio.WRITE_OWNER|winio.ACCESS_SYSTEM_SECURITY, createDisposition)
  377. if err != nil {
  378. return nil, err
  379. }
  380. defer dest.Close()
  381. err = winio.SetFileBasicInfo(dest, fileInfo)
  382. if err != nil {
  383. return nil, err
  384. }
  385. destw := winio.NewBackupFileWriter(dest, true)
  386. defer func() {
  387. cerr := destw.Close()
  388. if err == nil {
  389. err = cerr
  390. }
  391. }()
  392. _, err = io.Copy(destw, srcr)
  393. if err != nil {
  394. return nil, err
  395. }
  396. return fileInfo, nil
  397. }
  398. // cloneTree clones a directory tree using hard links. It skips hard links for
  399. // the file names in the provided map and just copies those files.
  400. func cloneTree(srcPath, destPath string, mutatedFiles map[string]bool) error {
  401. var di []dirInfo
  402. err := filepath.Walk(srcPath, func(srcFilePath string, info os.FileInfo, err error) error {
  403. if err != nil {
  404. return err
  405. }
  406. relPath, err := filepath.Rel(srcPath, srcFilePath)
  407. if err != nil {
  408. return err
  409. }
  410. destFilePath := filepath.Join(destPath, relPath)
  411. // Directories, reparse points, and files that will be mutated during
  412. // utility VM import must be copied. All other files can be hard linked.
  413. isReparsePoint := info.Sys().(*syscall.Win32FileAttributeData).FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0
  414. if info.IsDir() || isReparsePoint || mutatedFiles[relPath] {
  415. fi, err := copyFileWithMetadata(srcFilePath, destFilePath, info.IsDir())
  416. if err != nil {
  417. return err
  418. }
  419. if info.IsDir() && !isReparsePoint {
  420. di = append(di, dirInfo{path: destFilePath, fileInfo: *fi})
  421. }
  422. } else {
  423. err = os.Link(srcFilePath, destFilePath)
  424. if err != nil {
  425. return err
  426. }
  427. }
  428. // Don't recurse on reparse points.
  429. if info.IsDir() && isReparsePoint {
  430. return filepath.SkipDir
  431. }
  432. return nil
  433. })
  434. if err != nil {
  435. return err
  436. }
  437. return reapplyDirectoryTimes(di)
  438. }
  439. func (w *legacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) error {
  440. w.reset()
  441. err := w.init()
  442. if err != nil {
  443. return err
  444. }
  445. if name == utilityVMPath {
  446. return w.initUtilityVM()
  447. }
  448. if hasPathPrefix(name, utilityVMPath) {
  449. if !w.HasUtilityVM {
  450. return errors.New("missing UtilityVM directory")
  451. }
  452. if !hasPathPrefix(name, utilityVMFilesPath) && name != utilityVMFilesPath {
  453. return errors.New("invalid UtilityVM layer")
  454. }
  455. path := filepath.Join(w.destRoot, name)
  456. createDisposition := uint32(syscall.OPEN_EXISTING)
  457. if (fileInfo.FileAttributes & syscall.FILE_ATTRIBUTE_DIRECTORY) != 0 {
  458. st, err := os.Lstat(path)
  459. if err != nil && !os.IsNotExist(err) {
  460. return err
  461. }
  462. if st != nil {
  463. // Delete the existing file/directory if it is not the same type as this directory.
  464. existingAttr := st.Sys().(*syscall.Win32FileAttributeData).FileAttributes
  465. if (uint32(fileInfo.FileAttributes)^existingAttr)&(syscall.FILE_ATTRIBUTE_DIRECTORY|syscall.FILE_ATTRIBUTE_REPARSE_POINT) != 0 {
  466. if err = os.RemoveAll(path); err != nil {
  467. return err
  468. }
  469. st = nil
  470. }
  471. }
  472. if st == nil {
  473. if err = os.Mkdir(path, 0); err != nil {
  474. return err
  475. }
  476. }
  477. if fileInfo.FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT == 0 {
  478. w.uvmDi = append(w.uvmDi, dirInfo{path: path, fileInfo: *fileInfo})
  479. }
  480. } else {
  481. // Overwrite any existing hard link.
  482. err = os.Remove(path)
  483. if err != nil && !os.IsNotExist(err) {
  484. return err
  485. }
  486. createDisposition = syscall.CREATE_NEW
  487. }
  488. f, err := openFileOrDir(path, syscall.GENERIC_READ|syscall.GENERIC_WRITE|winio.WRITE_DAC|winio.WRITE_OWNER|winio.ACCESS_SYSTEM_SECURITY, createDisposition)
  489. if err != nil {
  490. return err
  491. }
  492. defer func() {
  493. if f != nil {
  494. f.Close()
  495. os.Remove(path)
  496. }
  497. }()
  498. err = winio.SetFileBasicInfo(f, fileInfo)
  499. if err != nil {
  500. return err
  501. }
  502. w.backupWriter = winio.NewBackupFileWriter(f, true)
  503. w.currentFile = f
  504. w.addedFiles[name] = true
  505. f = nil
  506. return nil
  507. }
  508. path := filepath.Join(w.root, name)
  509. if (fileInfo.FileAttributes & syscall.FILE_ATTRIBUTE_DIRECTORY) != 0 {
  510. err := os.Mkdir(path, 0)
  511. if err != nil {
  512. return err
  513. }
  514. path += ".$wcidirs$"
  515. }
  516. f, err := openFileOrDir(path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, syscall.CREATE_NEW)
  517. if err != nil {
  518. return err
  519. }
  520. defer func() {
  521. if f != nil {
  522. f.Close()
  523. os.Remove(path)
  524. }
  525. }()
  526. strippedFi := *fileInfo
  527. strippedFi.FileAttributes = 0
  528. err = winio.SetFileBasicInfo(f, &strippedFi)
  529. if err != nil {
  530. return err
  531. }
  532. if hasPathPrefix(name, hivesPath) {
  533. w.backupWriter = winio.NewBackupFileWriter(f, false)
  534. } else {
  535. // The file attributes are written before the stream.
  536. err = binary.Write(f, binary.LittleEndian, uint32(fileInfo.FileAttributes))
  537. if err != nil {
  538. return err
  539. }
  540. }
  541. w.currentFile = f
  542. w.addedFiles[name] = true
  543. f = nil
  544. return nil
  545. }
  546. func (w *legacyLayerWriter) AddLink(name string, target string) error {
  547. w.reset()
  548. err := w.init()
  549. if err != nil {
  550. return err
  551. }
  552. var roots []string
  553. if hasPathPrefix(target, filesPath) {
  554. // Look for cross-layer hard link targets in the parent layers, since
  555. // nothing is in the destination path yet.
  556. roots = w.parentRoots
  557. } else if hasPathPrefix(target, utilityVMFilesPath) {
  558. // Since the utility VM is fully cloned into the destination path
  559. // already, look for cross-layer hard link targets directly in the
  560. // destination path.
  561. roots = []string{w.destRoot}
  562. }
  563. if roots == nil || (!hasPathPrefix(name, filesPath) && !hasPathPrefix(name, utilityVMFilesPath)) {
  564. return errors.New("invalid hard link in layer")
  565. }
  566. // Find to try the target of the link in a previously added file. If that
  567. // fails, search in parent layers.
  568. var selectedRoot string
  569. if _, ok := w.addedFiles[target]; ok {
  570. selectedRoot = w.destRoot
  571. } else {
  572. for _, r := range roots {
  573. if _, err = os.Lstat(filepath.Join(r, target)); err != nil {
  574. if !os.IsNotExist(err) {
  575. return err
  576. }
  577. } else {
  578. selectedRoot = r
  579. break
  580. }
  581. }
  582. if selectedRoot == "" {
  583. return fmt.Errorf("failed to find link target for '%s' -> '%s'", name, target)
  584. }
  585. }
  586. // The link can't be written until after the ImportLayer call.
  587. w.PendingLinks = append(w.PendingLinks, pendingLink{
  588. Path: filepath.Join(w.destRoot, name),
  589. Target: filepath.Join(selectedRoot, target),
  590. })
  591. w.addedFiles[name] = true
  592. return nil
  593. }
  594. func (w *legacyLayerWriter) Remove(name string) error {
  595. if hasPathPrefix(name, filesPath) {
  596. w.tombstones = append(w.tombstones, name[len(filesPath)+1:])
  597. } else if hasPathPrefix(name, utilityVMFilesPath) {
  598. err := w.initUtilityVM()
  599. if err != nil {
  600. return err
  601. }
  602. // Make sure the path exists; os.RemoveAll will not fail if the file is
  603. // already gone, and this needs to be a fatal error for diagnostics
  604. // purposes.
  605. path := filepath.Join(w.destRoot, name)
  606. if _, err := os.Lstat(path); err != nil {
  607. return err
  608. }
  609. err = os.RemoveAll(path)
  610. if err != nil {
  611. return err
  612. }
  613. } else {
  614. return fmt.Errorf("invalid tombstone %s", name)
  615. }
  616. return nil
  617. }
  618. func (w *legacyLayerWriter) Write(b []byte) (int, error) {
  619. if w.backupWriter == nil {
  620. if w.currentFile == nil {
  621. return 0, errors.New("closed")
  622. }
  623. return w.currentFile.Write(b)
  624. }
  625. return w.backupWriter.Write(b)
  626. }
  627. func (w *legacyLayerWriter) Close() error {
  628. w.reset()
  629. err := w.init()
  630. if err != nil {
  631. return err
  632. }
  633. tf, err := os.Create(filepath.Join(w.root, "tombstones.txt"))
  634. if err != nil {
  635. return err
  636. }
  637. defer tf.Close()
  638. _, err = tf.Write([]byte("\xef\xbb\xbfVersion 1.0\n"))
  639. if err != nil {
  640. return err
  641. }
  642. for _, t := range w.tombstones {
  643. _, err = tf.Write([]byte(filepath.Join(`\`, t) + "\n"))
  644. if err != nil {
  645. return err
  646. }
  647. }
  648. if w.HasUtilityVM {
  649. err = reapplyDirectoryTimes(w.uvmDi)
  650. if err != nil {
  651. return err
  652. }
  653. }
  654. return nil
  655. }