Commit Graph

26506 Commits

Author SHA1 Message Date
Nalin Dahyabhai 0183a293dc Lock the mounts list with its own lockfile
Separate loading and saving the mountpoints.json table out of the main
layer load/save paths so that they can be called independently, so that
we can mount and unmount layers (which requires that we update that
information) when the layer list itself may only be held with a read
lock.

The new loadMounts() and saveMounts() methods need to be called only for
read-write layer stores.  Callers that just refer to the mount
information can take a read lock on the mounts information, but callers
that modify the mount information need to acquire a write lock.

Break the unwritten "stores don't manage their own locks" rule and have
the layer store handle managing the lock for the mountpoints list, with
the understanding that the layer store's lock will always have been
acquired before we try to take the mounts lock.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:53 -05:00
Nalin Dahyabhai 45c05928c4 Update a comment
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:53 -05:00
Nalin Dahyabhai 1194eb9848 layers/images: don't try to clean up with just a read-only lock
Don't attempt to remove conflicting names or finish layer cleanups if we
only have a read-only lock on layer or image stores, since doing either
means we'd have to modify the list of layers or images, and our lock
that we've obtained doesn't allow us to do that.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:53 -05:00
Nalin Dahyabhai af52b699ef Switch to read-only locks in some places
In Store methods that don't expect to change state, use a read lock.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:53 -05:00
Nalin Dahyabhai 45b0aa27aa Locker.Locked(): clarify that we're checking for write locks
Clarify that Locker.Locked() checks if we have a write lock, since
that's what we care about whenever we check it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:50 -05:00
Nalin Dahyabhai 06025caa49 CLI helper: print backtraces with errors
Print backtrace information when displaying an error returned by our
API, to make troubleshooting tests a bit easier.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai f61b77479f abs.bats: don't forget to shut things down after the test
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai f082271ea3 stores.bats: hard fail if we unexpected can't use read-only stores
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai 28be1e46f0 Bump GITVALIDATE_EPOCH
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Valentin Rothberg 5ecc5f23b3 lockfile: use a sync.RWMutex
Use a `sync.RWMutex` to synchronize the lockfile within the same process
space.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-26 14:19:15 -05:00
Daniel J Walsh 5524afef07
Merge pull request #288 from nalind/abs
GetStore(): resolve passed-in paths to absolute paths
2019-02-18 17:00:56 -05:00
Nalin Dahyabhai 6d609d1042 GetStore(): resolve passed-in paths to absolute paths
Resolve passed-in locations to absolute paths at startup.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-18 11:23:05 -05:00
Daniel J Walsh afa236759d
Merge pull request #287 from vrothberg/bump-to-1.10
Bump to 1.10
2019-02-17 08:21:38 -05:00
Valentin Rothberg 6542743f7a Move to v1.11-dev
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-16 10:04:19 +01:00
Valentin Rothberg 0a30cf1608 Bump to v1.10
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-16 10:02:48 +01:00
Daniel J Walsh 4442d3aa2f
Merge pull request #278 from vrothberg/rw-lock
reader-writer file locks
2019-02-15 12:05:53 -05:00
Valentin Rothberg 68d65106a0 enable parallel blob reads
Enable executing parallel `GetBlob()` executions in containers/image by
using reader-lock acquisitions in `ImageBigData()` and `Diff()`.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-15 15:00:37 +01:00
Valentin Rothberg f58686dcce lockfile: implement reader-writer locks
Implement reader-writer locks to allow allow multiple readers to hold
the lock in parallel.

* The locks are still based on fcntl(2).

* Changing the lock from a reader to a writer and vice versa will block
  on the syscall.

* A writer lock can be held only by one process.  To protect against
  concurrent accesses by gourtines within the same process space, use a
  writer mutex.

* Extend the Locker interface with the `RLock()` method to acquire a
  reader lock.  If the lock is set to be read-only, all calls to
  `Lock()` will be redirected to `RLock()`.  A reader lock is only
  released via fcntl(2) when all gourtines within the same process space
  have unlocked it.  This is done via an internal counter which is
  protected (among other things) by an internal state mutex.

* Panic on violations of the lock protocol, namely when calling
  `Unlock()` on an unlocked lock.  This helps detecting violations in
  the code but also protects the storage from corruption.  Doing this
  has revealed some bugs fixed in ealier commits.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-15 09:49:44 +01:00
Valentin Rothberg d89252da40 avoid `defer x.Unlock()` pattern in loops
Deferring method calls on loop variables must be avoided by all means as
the calls will be invoked on the last item of the loop.

The intermediate fix used in this commit is to allocate a new variable
on the heap for each loop iteration.  An example transformation is:

FROM:
for _, x := range x_slice {
	x.Lock()
	defer x.Unlock()
}

TO:
for _, x_itr := range x_slice {
	x := x_itr
	x.Lock()
	defer x.Unlock()
}

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-02-15 09:49:44 +01:00
Daniel J Walsh 0d890fd313
Merge pull request #286 from nalind/override-kernel-check-legacy
Make use of overlay.override_kernel_check a warning instead of an error
2019-02-12 21:59:13 -08:00
Nalin Dahyabhai 771658dbb8 Make use of overlay.override_kernel_check a warning instead of an error
When we removed all traces of override_kernel_check, we created a
situation where older configuration files would suddenly start causing
us to emit an error at startup.  Soften that to a warning, for now at
least.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-12 13:58:36 -05:00
Nalin Dahyabhai 06b6c2e4cf
Merge pull request #284 from nalind/always-digest
images: always set Digest if we have digests
2019-02-07 16:55:58 -05:00
Nalin Dahyabhai 6b2ee7f61c images: always set Digest if we have digests
Make sure that an Image that has at least one digest always has a
populated Digest field.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-07 14:07:16 -05:00
Daniel J Walsh be846769b4
Merge pull request #283 from nalind/multiple-manifests
Teach images to hold multiple manifests
2019-02-07 09:38:16 -08:00
Nalin Dahyabhai 096e5b23e7 Update generated files
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-07 10:27:36 -05:00
Nalin Dahyabhai ccf8bef6fa Teach images to hold multiple manifests
Change how we compute digests for BigData items with names that start
with "manifest" so that we use the image library's manifest.Digest()
function, which knows how to preprocess schema1 manifests to get the
right value, instead of just trying to finesse it.

Track the digests of multiple manifest-named items for images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-07 10:27:36 -05:00
Nalin Dahyabhai 488134ff6a image-by-digest.bats: print output
Display the output from commands before we check their exit status, so
that we can see what they output if a check fails.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-06 10:04:37 -05:00
Nalin Dahyabhai a6ca4fc7b4 Vendor github.com/containers/image
We use the image library's reference parser and manifest digester.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-06 10:04:37 -05:00
Daniel J Walsh 0c69438edd
Merge pull request #282 from nalind/reload-errors
Don't ignore errors reloading layer/image/container lists
2019-02-05 10:44:36 -08:00
Nalin Dahyabhai a74d0441db Don't ignore errors reloading layer/image/container lists
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-05 10:19:46 -05:00
Daniel J Walsh 0b67c788f2
Merge pull request #281 from umohnani8/config
Move structs for storage.conf to pkg/config
2019-02-04 13:54:50 -05:00
Urvashi Mohnani 74834ee9e0 Move structs for storage.conf to pkg/config
Need to access the storage structs in the machine-config
operator code for container runtime configuration but
with it being in store.go, it is pullng in way too many
dependencies. Moving it out to a separate package cuts down
the dependencies by a huge amount.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2019-02-03 21:21:32 -05:00
Daniel J Walsh a632212f30
Merge pull request #279 from rhatdan/master
Bump to v1.9
2019-02-01 10:13:25 -05:00
Daniel J Walsh 28c2ec3e51
Move to v1.10-dev
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-01 12:50:55 +00:00
Daniel J Walsh 5e7b1a10bd
Bump to v1.9
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-02-01 12:50:38 +00:00
Daniel J Walsh e16f47fabb
Merge pull request #274 from rhatdan/copy
Move copytar functions from buildah to storage
2019-02-01 13:49:24 +01:00
Daniel J Walsh 2ffffaf40f
Move copytar functions from buildah to storage
We want to use these functions in both podman and buildah
So move them out of buidlah into storage.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-31 15:26:03 +00:00
Daniel J Walsh ad2708c67d
Merge pull request #277 from rhatdan/version
Bump to version 1.8
2019-01-21 21:08:30 -05:00
Daniel J Walsh 3c1cea3e42
Move to v1.9-dev
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-21 21:07:15 -05:00
Daniel J Walsh 0a707ee5f0
Bump to v1.8 2019-01-21 21:06:07 -05:00
Daniel J Walsh 8a2e2172c5
Merge pull request #273 from rhatdan/master
vndr opencontainers/selinux
2019-01-21 16:36:05 -05:00
Valentin Rothberg 900a7e04db
Merge pull request #275 from giuseppe/disable-usingmetacopy-for-rootless
overlay: do not attempt metacopyup when using a mount program
2019-01-21 15:40:26 +01:00
Giuseppe Scrivano 308b57a78f
overlay: do not attempt metacopyup when using a mount program
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-01-21 10:10:25 +01:00
Daniel J Walsh 7deefec3d2
vndr opencontainers/selinux
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-18 15:09:39 -05:00
Daniel J Walsh f749f85350
Merge pull request #272 from rhatdan/vendor
Create new v1.7 version.
2019-01-18 14:13:59 -05:00
Daniel J Walsh 79898843a4
Move to v1.8-dev
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-18 10:59:17 -05:00
Daniel J Walsh 45f5181dda
Bump to v1.7
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-18 10:59:02 -05:00
Daniel J Walsh 891018027e
Merge pull request #271 from nalind/template-layers
drivers: add CreateFromTemplate()
2019-01-18 10:56:56 -05:00
Daniel J Walsh e03971bbe3
Merge pull request #268 from nalind/metacopy-check
overlay: check if metacopy is happening
2019-01-17 17:33:25 -05:00
Daniel J Walsh 509b3f052a
Merge pull request #270 from nalind/seclabel
Don't fail the mounter test because the kernel added options
2019-01-17 17:32:47 -05:00