Commit Graph

266 Commits

Author SHA1 Message Date
8fb804fc58 Fix the typo of URLs
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
Upstream-commit: fa378413f88054d0a336d675e7280930ddc86cb2
Component: engine
2016-10-19 17:46:27 +08:00
d85a4563ef Merge pull request #27483 from YuPengZTE/devFixLink
Fix the typo of link in devmapper
Upstream-commit: 32156e17584782ab7d08f37ec402c0d17bb2cd92
Component: engine
2016-10-18 12:45:31 -07:00
153b6651a5 Fix the typo of link in devmapper
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
Upstream-commit: f7701d90a94922fa6854cc80b2218392d6a4ac76
Component: engine
2016-10-18 16:02:38 +08:00
4b9781e130 all: replace loop with single append
Signed-off-by: Elena Morozova <lelenanam@gmail.com>
Upstream-commit: 64238fef8c7b739a2ae5648386cf594eb3a162e5
Component: engine
2016-10-13 13:31:52 -07:00
fa6f37076c Merge pull request #26898 from YuPengZTE/devErrorsNew
In error, the first letter is low-case letter
Upstream-commit: c2f57291ac04a1d582d7fcdedda7b1ad707543d5
Component: engine
2016-09-27 10:10:57 -04:00
ebdbeeeb36 In error, the first letter is low-case letter
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
Upstream-commit: 110ab746ba50e9febcdd246671f258036c71e59a
Component: engine
2016-09-27 10:40:07 +08:00
467aa61392 Optimized debug print in the 'deviceset.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 664ad19486b55a529ba2ba53b7d432b03dc5384a
Component: engine
2016-09-12 15:34:17 +08:00
30755d9f2c devmapper: Fail to start container if xfs_nospace_max_retries can't be enforced
We just introduced a new tunable dm.xfs_nospace_max_retries. But this tunable
will work only on new kernels where xfs supports this feature. On older
kernels xfs does not allow tuning this behavior.

There are two issues. First one is that if xfsSetNospaceRetries() fails,
it returns error but leaves the device activated and mounted. We should
be unmounting the device and deactivate it before returning.
 
Second issue is, if docker is started on older kernel, with
dm.xfs_nospace_max_retries specified, then docker will silently ignore the
fact that /sys file to tweak this behavior is not present and will continue.
But I think it might be better to fail container creation/start if kernel
does not support this feature.

This patch fixes it. After this patch, user will get an error like following
when container is run.

# docker run -ti fedora bash
docker: Error response from daemon: devmapper: user specified daemon option dm.xfs_nospace_max_retries but it does not seem to be supported on this system :open /sys/fs/xfs/dm-5/error/metadata/ENOSPC/max_retries: no such file or directory.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 6cc55dd65b363fe520c2ab29a9303f79afd4cadb
Component: engine
2016-09-07 14:03:01 -04:00
f9ef0edaad devmapper: Provide a knob dm.xfs_nospace_max_retries
When xfs filesystem is being used on top of thin pool, xfs can get ENOSPC
errors from thin pool when thin pool is full. As of now xfs retries the
IO and keeps on retrying and does not give up. This can result in container
application being stuck for a very long time. In fact I have seen instances
of unkillable processes. So that means once thin pool is full and process
gets stuck, container can't be stopped/killed either and only option left
seems to be power recycle of the box.

In another instance, writer did not block but failed after a while. But
when I tried to exit/stop the container, unmounting xfs hanged and only
thing I could do was power cycle the machine.

Now upstream kernel has committed patches where it allows user space to
customize user space behavior in case of errors. One of the knobs is
max_retries, which specifies how many times an IO should be retried
when ENOSPC is encountered.

This patch sets provides a tunable knob (dm.xfs_nospace_max_retries) so
that user can specify value for max_retries and tune xfs behavior. If
one sets this value to 0, xfs will not retry IO when ENOSPC error is
encountered. It will instead give up and shutdown filesystem.

This knob can be useful if one is running into unkillable
processes/containers issue on top of xfs.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 4f0017b9ad7dfa2e9dcdee69d000b98595893e60
Component: engine
2016-09-01 11:38:09 -04:00
1e0e8f732e Fixes Issue # 23418: Race condition between device deferred removal and resume device.
Problem Description:

An example scenario that involves deferred removal
1. A new base image gets created (e.g. 'docker load -i'). The base device is activated and
mounted at some point in time during image creation.
2. While image creation is in progress, a privileged container is started
from another image and the host's mount name space is shared with this
container ('docker run --privileged -v /:/host').
3. Image creation completes and the base device gets unmounted. However,
as the privileged container still holds a reference on the base image
mount point, the base device cannot be removed right away. So it gets
flagged for deferred removal.
4. Next, the privileged container terminates and thus its reference to the
base image mount point gets released. The base device (which is flagged
for deferred removal) may now be cleaned up by the device-mapper. This
opens up an opportunity for a race between a 'kworker' thread (executing
the do_deferred_remove() function) and the Docker daemon (executing the
CreateSnapDevice() function).

This PR cancel the deferred removal, if the device is marked for it. And reschedule the
deferred removal later after the device is resumed successfully.

Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: 0e633ee14aca32480ac4735675222c35f4e11d8c
Component: engine
2016-08-02 10:33:58 -04:00
e667b026a1 Add detail error logs when 'Unknown Device' error happens if devicemapper storage is used.
Signed-off-by: yuzou <zouyu7@huawei.com>
Upstream-commit: d4a2bcc9ac49d07c71822ce72b97861d5844b46d
Component: engine
2016-06-30 13:06:14 +08:00
19552d6875 Modularize dm.use_deferred_removal and dm.use_deferred_deletion logic.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: cac6658da061f01b4abd5b4bd1a7aeb234e8401d
Component: engine
2016-06-13 12:05:46 -04:00
04ae4edf2f Fix logrus formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

This fix fixes #23459.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: a72b45dbec3caeb3237d1af5aedd04adeb083571
Component: engine
2016-06-11 13:16:55 -07:00
763e6c326e *: fix logrus.Warn[f]
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 44ccbb317c2ca67fd8a88147b1ff80ce83d453cc
Component: engine
2016-06-11 19:42:38 +02:00
2360dea0b4 graphtest: fix cleanup logic
device Base should not exists on failure:

--- FAIL: TestDevmapperCreateBase (0.06s)
    graphtest_unix.go:122: stat
/tmp/docker-graphtest-079240530/devicemapper/mnt/Base/rootfs/a subdir:
no such file or directory
--- FAIL: TestDevmapperCreateSnap (0.00s)
    graphtest_unix.go:219: devmapper: device Base already
exists.

it should be:

--- FAIL: TestDevmapperCreateBase (0.25s)
	graphtest_unix.go:122: stat
/tmp/docker-graphtest-828994195/devicemapper/mnt/Base/rootfs/a subdir:
no such file or directory
--- FAIL: TestDevmapperCreateSnap (0.13s)
	graphtest_unix.go:122: stat
/tmp/docker-graphtest-828994195/devicemapper/mnt/Snap/rootfs/a subdir:
no such file or directory

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: b18062122d76a9f53822889874aa12103d491372
Component: engine
2016-05-31 20:08:57 +02:00
bd261166b3 Fixes Issue # 22992: docker commit failing.
1) docker create / run / start: this would create a snapshot device and mounts it onto the filesystem.
So the first time GET operation is called. it will create the rootfs directory and return the path to rootfs
2) Now when I do docker commit. It will call the GET operation second time. This time the refcount will check
that the count > 1 (count=2). so the rootfs already exists, it will just return the path to rootfs.

Earlier it was just returning the mp: /var/lib/docker/devicemapper/mnt/{ID} and hence the inconsistent paths error.

Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: 09d0720e2fb6e30ee018887399f353f93ac2d421
Component: engine
2016-05-27 14:35:46 -04:00
987aa6f79e Add reference counting to aufs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 5b6b8df0c1b5a54ae9a717810eedf9fc971e1321
Component: engine
2016-05-23 15:57:23 -07:00
50e99151eb Add fast path for fsmagic supported drivers
For things that we can check if they are mounted by using their fsmagic
we should use that and for others do it the slow way.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 1ba05cdb6ade7e3abd4c4c3221b5e27645460111
Component: engine
2016-05-23 15:57:23 -07:00
2b52cbdf3e Restore ref count
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 009ee16beff4f6d3607fa251019908cc72ce0a34
Component: engine
2016-05-23 15:57:23 -07:00
dab6ceb6f9 Merge pull request #21945 from rhvgoyal/export-min-free-space
Export Mininum Thin Pool Free Space through docker info
Upstream-commit: 227c83826aafbbcb3235d75cf7ab58392e552a83
Component: engine
2016-05-02 20:20:08 -04:00
76c8648306 Merge pull request #22168 from cpuguy83/22116_hack_in_layer_refcounts
Add refcounts to graphdrivers that use fsdiff
Upstream-commit: 8a0d2d8e57a4825fb21c0f8ef91bef513beebc35
Component: engine
2016-04-22 15:17:12 -07:00
f8ddc00d73 Add refcounts to graphdrivers that use fsdiff
This makes sure fsdiff doesn't try to unmount things that shouldn't be.

**Note**: This is intended as a temporary solution to have as minor a
change as possible for 1.11.1. A bigger change will be required in order
to support container re-attach.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 7342060b070df67481f8da4f394a57cac1671d56
Component: engine
2016-04-21 12:19:57 -04:00
4847a4f337 Export Mininum Thin Pool Free Space through docker info
Right now there is no way to know what's the minimum free space threshold
daemon is applying. It would be good to export it through docker info and
then user knows what's the current value. Also this could be useful to
higher level management tools which can look at this value and setup their
own internal thresholds for image garbage collection etc.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 55a9b8123d7e89692b5c25c846cf6707a8ce463a
Component: engine
2016-04-21 15:42:23 +00:00
897c0b707e Grow the container rootfs when it is necessary
Signed-off-by: mYmNeo <thomassong@tencent.com>
Upstream-commit: 34a66a14af326a259d4ff9fb84db6f678f116a17
Component: engine
2016-04-12 09:27:47 +08:00
0e63dec985 parseStorageOpt: return size rather than updating devInfo.Size field
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: 45dc5b46e2018d0a8c2d15c6b2917f3581211a6e
Component: engine
2016-04-11 10:34:13 -04:00
d4ec9845eb Adding readOnly parameter to graphdriver Create method
Since the layer store was introduced, the level above the graphdriver
now differentiates between read/write and read-only layers.  This
distinction is useful for graphdrivers that need to take special steps
when creating a layer based on whether it is read-only or not.
Adding this parameter allows the graphdrivers to differentiate, which
in the case of the Windows graphdriver, removes our dependence on parsing
the id of the parent for "-init" in order to infer this information.

This will also set the stage for unblocking some of the layer store
unit tests in the next preview build of Windows.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: ef5bfad3210a9e9c8b761f2c11c0c6289490ebff
Component: engine
2016-04-06 13:52:53 -07:00
9b4fb715c9 Improve udev unsupported error message
Show a different message if a dynamic binary
is running, but doesn't have udev sync support.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b8f38747e60eb76e19f08129ab27cb808d21c22a
Component: engine
2016-04-01 13:31:44 -07:00
9ab7e4327f CLI flag for docker create(run) to change block device size.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: b16decfccfdb0749c490be9272cb7b4789be87b4
Component: engine
2016-03-28 10:05:18 -04:00
778611a207 Move layer mount refcounts to mountedLayer
Instead of implementing refcounts at each graphdriver, implement this in
the layer package which is what the engine actually interacts with now.
This means interacting directly with the graphdriver is no longer
explicitly safe with regard to Get/Put calls being refcounted.

In addition, with the containerd, layers may still be mounted after
a daemon restart since we will no longer explicitly kill containers when
we shutdown or startup engine.
Because of this ref counts would need to be repopulated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 65d79e3e5e537039b244afd7eda29e721a93d84f
Component: engine
2016-03-23 14:42:52 -07:00
fba90c19ef Revert "Move layer mount refcounts to mountedLayer"
This reverts commit 563d0711f83952e561a0d7d5c48fef9810b4f010.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: e91de9fb9d175541acc95834de486d33feef552a
Component: engine
2016-03-23 00:33:02 -07:00
730efa6a55 Merge pull request #21107 from cpuguy83/one_ctr_to_rule_them_all
Move layer mount refcounts to mountedLayer
Upstream-commit: 92a3ece35a10092af0944f175a15b2390f6c666e
Component: engine
2016-03-22 21:19:00 -07:00
44acd43622 Move layer mount refcounts to mountedLayer
Instead of implementing refcounts at each graphdriver, implement this in
the layer package which is what the engine actually interacts with now.
This means interacting directly with the graphdriver is no longer
explicitly safe with regard to Get/Put calls being refcounted.

In addition, with the containerd, layers may still be mounted after
a daemon restart since we will no longer explicitly kill containers when
we shutdown or startup engine.
Because of this ref counts would need to be repopulated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 563d0711f83952e561a0d7d5c48fef9810b4f010
Component: engine
2016-03-22 11:36:28 -04:00
bf213f3332 Remove unneeded references to execDriver
This includes:
 - updating the docs
 - removing dangling variables

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 8af4f89cba09105f3d581926aca6e231326f7054
Component: engine
2016-03-21 13:06:08 -07:00
f588ea4d9d Fix the assignment to wrong variable
We should be assigning value to minFreeMetadata instead of minFreeData. This
is copy/paste error.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 4141a00921e3ae814736249ec1806d5d35c8d46c
Component: engine
2016-03-17 15:19:08 +00:00
fa85755ee7 Merge pull request #21097 from thaJeztah/dont-run-without-udev-sync
Fail when devicemapper doesn't support udev-sync
Upstream-commit: 37a1fadae6390e38da85d3fffe7a49e00de2830e
Component: engine
2016-03-14 21:18:01 -04:00
ed1cf843bd Fail when devicemapper doesn't support udev-sync
Now what we provide dynamic binaries for all plaforms,
we shouldn't try to run docker without udev sync support.

This change changes the previous warning to an Error,
unless the user explicitly overrides the warning, in
which case they're at their own risk.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: de641715105a116042ad9be5e1b2d1bb2962eb9c
Component: engine
2016-03-10 19:13:44 +01:00
e7b4b05653 devmapper: Add a new option dm.min_free_space
Once thin pool gets full, bad things can happen. Especially in case of xfs
it is possible that xfs keeps on retrying IO infinitely (for certain kind
of IO) and container hangs. 

One way to mitigate the problem is that once thin pool is about to get full,
start failing some of the docker operations like pulling new images or
creation of new containers. That way user will get warning ahead of time
and can try to rectify it by creating more free space in thin pool. This
can be done either by deleting existing images/containers or by adding more
free space to thin pool.

This patch adds a new option dm.min_free_space to devicemapper graph
driver. Say one specifies dm.min_free_space=10%. This means atleast
10% of data and metadata blocks should be free in pool before new device
creation is allowed, otherwise operation will fail.

By default min_free_space is 10%. User can change it by specifying
dm.min_free_space=X% on command line. A value of 0% will disable the
check.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 2e222f69b3486cf20039525a882ae4153b52f92c
Component: engine
2016-03-07 20:27:39 +00:00
f62b97e499 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Upstream-commit: 2eee613326fb59fd168849618d14a9054a40f9f5
Component: engine
2016-02-22 20:27:15 +01:00
3587269c45 Merge pull request #19123 from shishir-a412ed/rootfs_size_configurable
daemon option (--storage-opt dm.basesize) for increasing the base device size on daemon restart
Upstream-commit: 661d75f39858934c230c59a68d908ef203c34136
Component: engine
2016-01-13 13:22:08 -08:00
3baefd3b5b daemon option (--storage-opt dm.basesize) for increasing the base device size on daemon restart
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Upstream-commit: e47112d3e812b90b240624711e7a5d2d203d6746
Component: engine
2016-01-13 13:57:31 -05:00
783a9aa06b Mark device ID free only if device actually got deleted
Right now if somebody has enabled deferred device deletion, then
deleteTransaction() returns success even if device could not be deleted. It
has been marked for deferred deletion. Right now we will mark device ID free
and potentially use it again when somebody tries to create new container. And
that's wrong. Device ID is not free yet. It will become free once devices
has actually been deleted by the goroutine later.

So move the location of call to markDeviceIDFree() to a place where we know
device actually got deleted and was not marked for deferred deletion.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 2dccb562dff79fef0f7a1d3b5f0e760e9d799d44
Component: engine
2016-01-11 18:57:37 +00:00
8b5a2050f9 loopback: separate loop logic from devicemapper
The loopback logic is not technically exclusive to the devicemapper
driver. This reorganizes the code such that the loopback code is usable
outside of the devicemapper package and driver.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: af597527121c0ad973e9d0ae4f9cf970da1513cc
Component: engine
2015-12-18 10:57:43 -05:00
3d517a11e5 Replace pkg/units with docker/go-units.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 4fef42ba206ac90346e6e0fe25bead3f77dc4b0f
Component: engine
2015-12-16 12:26:49 -05:00
bc2d1566f2 devmapper: store base device fs type
After the very first init of the graph `docker info` correctly shows the
base fs type under `Backing Filesystem`. This information isn't stored
anywhere. After a restart (w/o erasing `/var/lib/docker`) `docker info`
shows an empty string under `Backing Filesystem`.
This patch records the base fs type after the first run in the metadata
or, to fix old devices that don't have this info in the metadata, just
probe the fs type of the base device at graph startup.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: f22ee02c6d6bd16f2179e71366ec641a7d234e96
Component: engine
2015-12-15 09:33:19 +01:00
f1d7c7a10b Make daemon/graphdriver/devmapper log messages with a common, consistent prefix.
Closes #16667

Uses the prefix "devmapper:" for all the fmt and logrus error, debug, and info messages.

Signed-off-by: Chris Dituri <csdituri@gmail.com>
Upstream-commit: 0aa6ace6e6e819551d21ebdcaa0c5802f76d7603
Component: engine
2015-12-14 21:35:13 -06:00
3c4fcf6b7a Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
Upstream-commit: 927b334ebfc786276a039e45ec097e71bf9a104c
Component: engine
2015-12-13 18:04:12 +02:00
1aaaffc214 Fixed typo change deivce to device.
This changes deivce to device in daemon, test and docs.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 7c077c2c3443fdb9b13b7790bc96cdaa287cf381
Component: engine
2015-12-10 15:23:05 -06:00
cb952213f7 devmapper: remove unused var
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 037cbcec989f7867b6062455e8b042b8d2b0ab18
Component: engine
2015-12-10 08:28:02 +01:00
5e25f840c3 Fix Put without Get in devicemapper
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Upstream-commit: f7bdb973578a08a5012c741e4ebb262d2dd81165
Component: engine
2015-12-03 22:22:25 +08:00
b17c4f91f6 devmapper: Log start and end of filesystem creation
ext4 filesystem creation can take a long time on 100G thin device and
systemd might time out and kill docker service. Often user is left thinking
why docker is taking so long and logs don't give any hint. Log an info
message in journal for start and end of filesystem creation. That way
a user can look at logs and figure out that filesystem creation is
taking long time.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: a489e685c0d17455463945316cfe366e4e65dca6
Component: engine
2015-12-01 13:05:46 +00:00