overlay.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. // +build linux
  2. package overlay2
  3. import (
  4. "bufio"
  5. "errors"
  6. "fmt"
  7. "io"
  8. "io/ioutil"
  9. "os"
  10. "os/exec"
  11. "path"
  12. "path/filepath"
  13. "strconv"
  14. "strings"
  15. "syscall"
  16. "github.com/Sirupsen/logrus"
  17. "github.com/docker/docker/daemon/graphdriver"
  18. "github.com/docker/docker/daemon/graphdriver/overlayutils"
  19. "github.com/docker/docker/daemon/graphdriver/quota"
  20. "github.com/docker/docker/pkg/archive"
  21. "github.com/docker/docker/pkg/chrootarchive"
  22. "github.com/docker/docker/pkg/directory"
  23. "github.com/docker/docker/pkg/fsutils"
  24. "github.com/docker/docker/pkg/idtools"
  25. "github.com/docker/docker/pkg/mount"
  26. "github.com/docker/docker/pkg/parsers"
  27. "github.com/docker/docker/pkg/parsers/kernel"
  28. "github.com/docker/go-units"
  29. "github.com/opencontainers/runc/libcontainer/label"
  30. )
  31. var (
  32. // untar defines the untar method
  33. untar = chrootarchive.UntarUncompressed
  34. )
  35. // This backend uses the overlay union filesystem for containers
  36. // with diff directories for each layer.
  37. // This version of the overlay driver requires at least kernel
  38. // 4.0.0 in order to support mounting multiple diff directories.
  39. // Each container/image has at least a "diff" directory and "link" file.
  40. // If there is also a "lower" file when there are diff layers
  41. // below as well as "merged" and "work" directories. The "diff" directory
  42. // has the upper layer of the overlay and is used to capture any
  43. // changes to the layer. The "lower" file contains all the lower layer
  44. // mounts separated by ":" and ordered from uppermost to lowermost
  45. // layers. The overlay itself is mounted in the "merged" directory,
  46. // and the "work" dir is needed for overlay to work.
  47. // The "link" file for each layer contains a unique string for the layer.
  48. // Under the "l" directory at the root there will be a symbolic link
  49. // with that unique string pointing the "diff" directory for the layer.
  50. // The symbolic links are used to reference lower layers in the "lower"
  51. // file and on mount. The links are used to shorten the total length
  52. // of a layer reference without requiring changes to the layer identifier
  53. // or root directory. Mounts are always done relative to root and
  54. // referencing the symbolic links in order to ensure the number of
  55. // lower directories can fit in a single page for making the mount
  56. // syscall. A hard upper limit of 128 lower layers is enforced to ensure
  57. // that mounts do not fail due to length.
  58. const (
  59. driverName = "overlay2"
  60. linkDir = "l"
  61. lowerFile = "lower"
  62. maxDepth = 128
  63. // idLength represents the number of random characters
  64. // which can be used to create the unique link identifer
  65. // for every layer. If this value is too long then the
  66. // page size limit for the mount command may be exceeded.
  67. // The idLength should be selected such that following equation
  68. // is true (512 is a buffer for label metadata).
  69. // ((idLength + len(linkDir) + 1) * maxDepth) <= (pageSize - 512)
  70. idLength = 26
  71. )
  72. type overlayOptions struct {
  73. overrideKernelCheck bool
  74. quota quota.Quota
  75. }
  76. // Driver contains information about the home directory and the list of active mounts that are created using this driver.
  77. type Driver struct {
  78. home string
  79. uidMaps []idtools.IDMap
  80. gidMaps []idtools.IDMap
  81. ctr *graphdriver.RefCounter
  82. quotaCtl *quota.Control
  83. options overlayOptions
  84. naiveDiff graphdriver.DiffDriver
  85. supportsDType bool
  86. }
  87. var (
  88. backingFs = "<unknown>"
  89. projectQuotaSupported = false
  90. )
  91. func init() {
  92. graphdriver.Register(driverName, Init)
  93. }
  94. // Init returns the a native diff driver for overlay filesystem.
  95. // If overlay filesystem is not supported on the host, graphdriver.ErrNotSupported is returned as error.
  96. // If an overlay filesystem is not supported over an existing filesystem then error graphdriver.ErrIncompatibleFS is returned.
  97. func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
  98. opts, err := parseOptions(options)
  99. if err != nil {
  100. return nil, err
  101. }
  102. if err := supportsOverlay(); err != nil {
  103. return nil, graphdriver.ErrNotSupported
  104. }
  105. // require kernel 4.0.0 to ensure multiple lower dirs are supported
  106. v, err := kernel.GetKernelVersion()
  107. if err != nil {
  108. return nil, err
  109. }
  110. if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 4, Major: 0, Minor: 0}) < 0 {
  111. if !opts.overrideKernelCheck {
  112. return nil, graphdriver.ErrNotSupported
  113. }
  114. logrus.Warn("Using pre-4.0.0 kernel for overlay2, mount failures may require kernel update")
  115. }
  116. fsMagic, err := graphdriver.GetFSMagic(home)
  117. if err != nil {
  118. return nil, err
  119. }
  120. if fsName, ok := graphdriver.FsNames[fsMagic]; ok {
  121. backingFs = fsName
  122. }
  123. // check if they are running over btrfs, aufs, zfs, overlay, or ecryptfs
  124. switch fsMagic {
  125. case graphdriver.FsMagicBtrfs, graphdriver.FsMagicAufs, graphdriver.FsMagicZfs, graphdriver.FsMagicOverlay, graphdriver.FsMagicEcryptfs:
  126. logrus.Errorf("'overlay2' is not supported over %s", backingFs)
  127. return nil, graphdriver.ErrIncompatibleFS
  128. }
  129. rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
  130. if err != nil {
  131. return nil, err
  132. }
  133. // Create the driver home dir
  134. if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil && !os.IsExist(err) {
  135. return nil, err
  136. }
  137. if err := mount.MakePrivate(home); err != nil {
  138. return nil, err
  139. }
  140. supportsDType, err := fsutils.SupportsDType(home)
  141. if err != nil {
  142. return nil, err
  143. }
  144. if !supportsDType {
  145. // not a fatal error until v1.16 (#27443)
  146. logrus.Warn(overlayutils.ErrDTypeNotSupported("overlay2", backingFs))
  147. }
  148. d := &Driver{
  149. home: home,
  150. uidMaps: uidMaps,
  151. gidMaps: gidMaps,
  152. ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
  153. supportsDType: supportsDType,
  154. }
  155. d.naiveDiff = graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps)
  156. if backingFs == "xfs" {
  157. // Try to enable project quota support over xfs.
  158. if d.quotaCtl, err = quota.NewControl(home); err == nil {
  159. projectQuotaSupported = true
  160. }
  161. }
  162. logrus.Debugf("backingFs=%s, projectQuotaSupported=%v", backingFs, projectQuotaSupported)
  163. return d, nil
  164. }
  165. func parseOptions(options []string) (*overlayOptions, error) {
  166. o := &overlayOptions{}
  167. for _, option := range options {
  168. key, val, err := parsers.ParseKeyValueOpt(option)
  169. if err != nil {
  170. return nil, err
  171. }
  172. key = strings.ToLower(key)
  173. switch key {
  174. case "overlay2.override_kernel_check":
  175. o.overrideKernelCheck, err = strconv.ParseBool(val)
  176. if err != nil {
  177. return nil, err
  178. }
  179. default:
  180. return nil, fmt.Errorf("overlay2: Unknown option %s\n", key)
  181. }
  182. }
  183. return o, nil
  184. }
  185. func supportsOverlay() error {
  186. // We can try to modprobe overlay first before looking at
  187. // proc/filesystems for when overlay is supported
  188. exec.Command("modprobe", "overlay").Run()
  189. f, err := os.Open("/proc/filesystems")
  190. if err != nil {
  191. return err
  192. }
  193. defer f.Close()
  194. s := bufio.NewScanner(f)
  195. for s.Scan() {
  196. if s.Text() == "nodev\toverlay" {
  197. return nil
  198. }
  199. }
  200. logrus.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.")
  201. return graphdriver.ErrNotSupported
  202. }
  203. func (d *Driver) String() string {
  204. return driverName
  205. }
  206. // Status returns current driver information in a two dimensional string array.
  207. // Output contains "Backing Filesystem" used in this implementation.
  208. func (d *Driver) Status() [][2]string {
  209. return [][2]string{
  210. {"Backing Filesystem", backingFs},
  211. {"Supports d_type", strconv.FormatBool(d.supportsDType)},
  212. }
  213. }
  214. // GetMetadata returns meta data about the overlay driver such as
  215. // LowerDir, UpperDir, WorkDir and MergeDir used to store data.
  216. func (d *Driver) GetMetadata(id string) (map[string]string, error) {
  217. dir := d.dir(id)
  218. if _, err := os.Stat(dir); err != nil {
  219. return nil, err
  220. }
  221. metadata := map[string]string{
  222. "WorkDir": path.Join(dir, "work"),
  223. "MergedDir": path.Join(dir, "merged"),
  224. "UpperDir": path.Join(dir, "diff"),
  225. }
  226. lowerDirs, err := d.getLowerDirs(id)
  227. if err != nil {
  228. return nil, err
  229. }
  230. if len(lowerDirs) > 0 {
  231. metadata["LowerDir"] = strings.Join(lowerDirs, ":")
  232. }
  233. return metadata, nil
  234. }
  235. // Cleanup any state created by overlay which should be cleaned when daemon
  236. // is being shutdown. For now, we just have to unmount the bind mounted
  237. // we had created.
  238. func (d *Driver) Cleanup() error {
  239. return mount.Unmount(d.home)
  240. }
  241. // CreateReadWrite creates a layer that is writable for use as a container
  242. // file system.
  243. func (d *Driver) CreateReadWrite(id, parent, mountLabel string, storageOpt map[string]string) error {
  244. return d.Create(id, parent, mountLabel, storageOpt)
  245. }
  246. // Create is used to create the upper, lower, and merge directories required for overlay fs for a given id.
  247. // The parent filesystem is used to configure these directories for the overlay.
  248. func (d *Driver) Create(id, parent, mountLabel string, storageOpt map[string]string) (retErr error) {
  249. if len(storageOpt) != 0 && !projectQuotaSupported {
  250. return fmt.Errorf("--storage-opt is supported only for overlay over xfs with 'pquota' mount option")
  251. }
  252. dir := d.dir(id)
  253. rootUID, rootGID, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
  254. if err != nil {
  255. return err
  256. }
  257. if err := idtools.MkdirAllAs(path.Dir(dir), 0700, rootUID, rootGID); err != nil {
  258. return err
  259. }
  260. if err := idtools.MkdirAs(dir, 0700, rootUID, rootGID); err != nil {
  261. return err
  262. }
  263. defer func() {
  264. // Clean up on failure
  265. if retErr != nil {
  266. os.RemoveAll(dir)
  267. }
  268. }()
  269. if len(storageOpt) > 0 {
  270. driver := &Driver{}
  271. if err := d.parseStorageOpt(storageOpt, driver); err != nil {
  272. return err
  273. }
  274. if driver.options.quota.Size > 0 {
  275. // Set container disk quota limit
  276. if err := d.quotaCtl.SetQuota(dir, driver.options.quota); err != nil {
  277. return err
  278. }
  279. }
  280. }
  281. if err := idtools.MkdirAs(path.Join(dir, "diff"), 0755, rootUID, rootGID); err != nil {
  282. return err
  283. }
  284. lid := generateID(idLength)
  285. if err := os.Symlink(path.Join("..", id, "diff"), path.Join(d.home, linkDir, lid)); err != nil {
  286. return err
  287. }
  288. // Write link id to link file
  289. if err := ioutil.WriteFile(path.Join(dir, "link"), []byte(lid), 0644); err != nil {
  290. return err
  291. }
  292. // if no parent directory, done
  293. if parent == "" {
  294. return nil
  295. }
  296. if err := idtools.MkdirAs(path.Join(dir, "work"), 0700, rootUID, rootGID); err != nil {
  297. return err
  298. }
  299. if err := idtools.MkdirAs(path.Join(dir, "merged"), 0700, rootUID, rootGID); err != nil {
  300. return err
  301. }
  302. lower, err := d.getLower(parent)
  303. if err != nil {
  304. return err
  305. }
  306. if lower != "" {
  307. if err := ioutil.WriteFile(path.Join(dir, lowerFile), []byte(lower), 0666); err != nil {
  308. return err
  309. }
  310. }
  311. return nil
  312. }
  313. // Parse overlay storage options
  314. func (d *Driver) parseStorageOpt(storageOpt map[string]string, driver *Driver) error {
  315. // Read size to set the disk project quota per container
  316. for key, val := range storageOpt {
  317. key := strings.ToLower(key)
  318. switch key {
  319. case "size":
  320. size, err := units.RAMInBytes(val)
  321. if err != nil {
  322. return err
  323. }
  324. driver.options.quota.Size = uint64(size)
  325. default:
  326. return fmt.Errorf("Unknown option %s", key)
  327. }
  328. }
  329. return nil
  330. }
  331. func (d *Driver) getLower(parent string) (string, error) {
  332. parentDir := d.dir(parent)
  333. // Ensure parent exists
  334. if _, err := os.Lstat(parentDir); err != nil {
  335. return "", err
  336. }
  337. // Read Parent link fileA
  338. parentLink, err := ioutil.ReadFile(path.Join(parentDir, "link"))
  339. if err != nil {
  340. return "", err
  341. }
  342. lowers := []string{path.Join(linkDir, string(parentLink))}
  343. parentLower, err := ioutil.ReadFile(path.Join(parentDir, lowerFile))
  344. if err == nil {
  345. parentLowers := strings.Split(string(parentLower), ":")
  346. lowers = append(lowers, parentLowers...)
  347. }
  348. if len(lowers) > maxDepth {
  349. return "", errors.New("max depth exceeded")
  350. }
  351. return strings.Join(lowers, ":"), nil
  352. }
  353. func (d *Driver) dir(id string) string {
  354. return path.Join(d.home, id)
  355. }
  356. func (d *Driver) getLowerDirs(id string) ([]string, error) {
  357. var lowersArray []string
  358. lowers, err := ioutil.ReadFile(path.Join(d.dir(id), lowerFile))
  359. if err == nil {
  360. for _, s := range strings.Split(string(lowers), ":") {
  361. lp, err := os.Readlink(path.Join(d.home, s))
  362. if err != nil {
  363. return nil, err
  364. }
  365. lowersArray = append(lowersArray, path.Clean(path.Join(d.home, linkDir, lp)))
  366. }
  367. } else if !os.IsNotExist(err) {
  368. return nil, err
  369. }
  370. return lowersArray, nil
  371. }
  372. // Remove cleans the directories that are created for this id.
  373. func (d *Driver) Remove(id string) error {
  374. dir := d.dir(id)
  375. lid, err := ioutil.ReadFile(path.Join(dir, "link"))
  376. if err == nil {
  377. if err := os.RemoveAll(path.Join(d.home, linkDir, string(lid))); err != nil {
  378. logrus.Debugf("Failed to remove link: %v", err)
  379. }
  380. }
  381. if err := os.RemoveAll(dir); err != nil && !os.IsNotExist(err) {
  382. return err
  383. }
  384. return nil
  385. }
  386. // Get creates and mounts the required file system for the given id and returns the mount path.
  387. func (d *Driver) Get(id string, mountLabel string) (s string, err error) {
  388. dir := d.dir(id)
  389. if _, err := os.Stat(dir); err != nil {
  390. return "", err
  391. }
  392. diffDir := path.Join(dir, "diff")
  393. lowers, err := ioutil.ReadFile(path.Join(dir, lowerFile))
  394. if err != nil {
  395. // If no lower, just return diff directory
  396. if os.IsNotExist(err) {
  397. return diffDir, nil
  398. }
  399. return "", err
  400. }
  401. mergedDir := path.Join(dir, "merged")
  402. if count := d.ctr.Increment(mergedDir); count > 1 {
  403. return mergedDir, nil
  404. }
  405. defer func() {
  406. if err != nil {
  407. if c := d.ctr.Decrement(mergedDir); c <= 0 {
  408. syscall.Unmount(mergedDir, 0)
  409. }
  410. }
  411. }()
  412. workDir := path.Join(dir, "work")
  413. splitLowers := strings.Split(string(lowers), ":")
  414. absLowers := make([]string, len(splitLowers))
  415. for i, s := range splitLowers {
  416. absLowers[i] = path.Join(d.home, s)
  417. }
  418. opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", strings.Join(absLowers, ":"), path.Join(dir, "diff"), path.Join(dir, "work"))
  419. mountData := label.FormatMountLabel(opts, mountLabel)
  420. mount := syscall.Mount
  421. mountTarget := mergedDir
  422. pageSize := syscall.Getpagesize()
  423. // Go can return a larger page size than supported by the system
  424. // as of go 1.7. This will be fixed in 1.8 and this block can be
  425. // removed when building with 1.8.
  426. // See https://github.com/golang/go/commit/1b9499b06989d2831e5b156161d6c07642926ee1
  427. // See https://github.com/docker/docker/issues/27384
  428. if pageSize > 4096 {
  429. pageSize = 4096
  430. }
  431. // Use relative paths and mountFrom when the mount data has exceeded
  432. // the page size. The mount syscall fails if the mount data cannot
  433. // fit within a page and relative links make the mount data much
  434. // smaller at the expense of requiring a fork exec to chroot.
  435. if len(mountData) > pageSize {
  436. opts = fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", string(lowers), path.Join(id, "diff"), path.Join(id, "work"))
  437. mountData = label.FormatMountLabel(opts, mountLabel)
  438. if len(mountData) > pageSize {
  439. return "", fmt.Errorf("cannot mount layer, mount label too large %d", len(mountData))
  440. }
  441. mount = func(source string, target string, mType string, flags uintptr, label string) error {
  442. return mountFrom(d.home, source, target, mType, flags, label)
  443. }
  444. mountTarget = path.Join(id, "merged")
  445. }
  446. if err := mount("overlay", mountTarget, "overlay", 0, mountData); err != nil {
  447. return "", fmt.Errorf("error creating overlay mount to %s: %v", mergedDir, err)
  448. }
  449. // chown "workdir/work" to the remapped root UID/GID. Overlay fs inside a
  450. // user namespace requires this to move a directory from lower to upper.
  451. rootUID, rootGID, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
  452. if err != nil {
  453. return "", err
  454. }
  455. if err := os.Chown(path.Join(workDir, "work"), rootUID, rootGID); err != nil {
  456. return "", err
  457. }
  458. return mergedDir, nil
  459. }
  460. // Put unmounts the mount path created for the give id.
  461. func (d *Driver) Put(id string) error {
  462. mountpoint := path.Join(d.dir(id), "merged")
  463. if count := d.ctr.Decrement(mountpoint); count > 0 {
  464. return nil
  465. }
  466. if err := syscall.Unmount(mountpoint, 0); err != nil {
  467. logrus.Debugf("Failed to unmount %s overlay: %s - %v", id, mountpoint, err)
  468. }
  469. return nil
  470. }
  471. // Exists checks to see if the id is already mounted.
  472. func (d *Driver) Exists(id string) bool {
  473. _, err := os.Stat(d.dir(id))
  474. return err == nil
  475. }
  476. // isParent returns if the passed in parent is the direct parent of the passed in layer
  477. func (d *Driver) isParent(id, parent string) bool {
  478. lowers, err := d.getLowerDirs(id)
  479. if err != nil {
  480. return false
  481. }
  482. if parent == "" && len(lowers) > 0 {
  483. return false
  484. }
  485. parentDir := d.dir(parent)
  486. var ld string
  487. if len(lowers) > 0 {
  488. ld = filepath.Dir(lowers[0])
  489. }
  490. if ld == "" && parent == "" {
  491. return true
  492. }
  493. return ld == parentDir
  494. }
  495. // ApplyDiff applies the new layer into a root
  496. func (d *Driver) ApplyDiff(id string, parent string, diff io.Reader) (size int64, err error) {
  497. if !d.isParent(id, parent) {
  498. return d.naiveDiff.ApplyDiff(id, parent, diff)
  499. }
  500. applyDir := d.getDiffPath(id)
  501. logrus.Debugf("Applying tar in %s", applyDir)
  502. // Overlay doesn't need the parent id to apply the diff
  503. if err := untar(diff, applyDir, &archive.TarOptions{
  504. UIDMaps: d.uidMaps,
  505. GIDMaps: d.gidMaps,
  506. WhiteoutFormat: archive.OverlayWhiteoutFormat,
  507. }); err != nil {
  508. return 0, err
  509. }
  510. return d.DiffSize(id, parent)
  511. }
  512. func (d *Driver) getDiffPath(id string) string {
  513. dir := d.dir(id)
  514. return path.Join(dir, "diff")
  515. }
  516. // DiffSize calculates the changes between the specified id
  517. // and its parent and returns the size in bytes of the changes
  518. // relative to its base filesystem directory.
  519. func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
  520. if !d.isParent(id, parent) {
  521. return d.naiveDiff.DiffSize(id, parent)
  522. }
  523. return directory.Size(d.getDiffPath(id))
  524. }
  525. // Diff produces an archive of the changes between the specified
  526. // layer and its parent layer which may be "".
  527. func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) {
  528. if !d.isParent(id, parent) {
  529. return d.naiveDiff.Diff(id, parent)
  530. }
  531. diffPath := d.getDiffPath(id)
  532. logrus.Debugf("Tar with options on %s", diffPath)
  533. return archive.TarWithOptions(diffPath, &archive.TarOptions{
  534. Compression: archive.Uncompressed,
  535. UIDMaps: d.uidMaps,
  536. GIDMaps: d.gidMaps,
  537. WhiteoutFormat: archive.OverlayWhiteoutFormat,
  538. })
  539. }
  540. // Changes produces a list of changes between the specified layer
  541. // and its parent layer. If parent is "", then all changes will be ADD changes.
  542. func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
  543. if !d.isParent(id, parent) {
  544. return d.naiveDiff.Changes(id, parent)
  545. }
  546. // Overlay doesn't have snapshots, so we need to get changes from all parent
  547. // layers.
  548. diffPath := d.getDiffPath(id)
  549. layers, err := d.getLowerDirs(id)
  550. if err != nil {
  551. return nil, err
  552. }
  553. return archive.OverlayChanges(layers, diffPath)
  554. }