Skip to content

devmapper: Set xfs max_retries to 0 upon ENOSPC - #26212

Merged
crosbymichael merged 1 commit into
moby:masterfrom
rhvgoyal:xfs-enospc
Sep 6, 2016
Merged

crosbymichael merged 1 commit into
moby:masterfrom
rhvgoyal:xfs-enospc

Conversation

@rhvgoyal

Copy link
Copy Markdown
Contributor

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 max_retries to 0 to tell xfs to fail fast when ENOSPC
is encountered. This means when thin pool is full, xfs will not retry
IO and return error to application. This will also shutdown the xfs
filesystem. And that means further IO to that mount will not succeed.

That should make sure we will not see unkillable applications/containers
when thin pool fills up.

Signed-off-by: Vivek Goyal [email protected]

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

Pushed one more time. Fixed go-lint complaint.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@thaJeztah @crosbymichael PTAL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you write to the file below if you didn't open it here? shoudln't you return?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Yes, I should return after warning.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@runcom PTAL

@runcom

runcom commented Aug 31, 2016

Copy link
Copy Markdown
Member

LGTM, thanks @rhvgoyal

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

Don't merged this yet. I am doing some more testing on this.

@crosbymichael

Copy link
Copy Markdown
Contributor

@rhvgoyal just ping me when testing is complete on your end

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 <[email protected]>
@rhvgoyal

rhvgoyal commented Sep 1, 2016

Copy link
Copy Markdown
Contributor Author

Ok, I have changed this patch. Instead of setting max_retries to 0 unconditionally, I am providing a tunable knob and let user choose the behavior based on their needs.

Ideally even default xfs behavior is not bad. They will keep on retrying IO in hope that it will finish. (Somebody will extend thin pool or some other containers/images will go away etc). Only problem is
that it should not result in an unkillable container.

Now xfs seems to have a default of fail_at_mount=1. That means if somebody is trying to unmount xfs, it will cancel pending IO. That should mean that if one is trying to stop container, then unmount operation
should trigger cancelling of pending IO and container should be stoppable (ideally). But there are some issues there currently and I have talked to xfs developers and they are looking into it.

So while current defaults are not working perfectly on top of thin pool, I think down the line it should be all fixed. So for now now I am not changing docker default and relying on kernel defaults.

Instead providing this knob should help users who notice unkillable process/container. They can try setting dm.xfs_nospace_max_retries=0 and that should help.

@rhvgoyal

rhvgoyal commented Sep 1, 2016

Copy link
Copy Markdown
Contributor Author

@runcom @crosbymichael PTAL.

@runcom

runcom commented Sep 1, 2016

Copy link
Copy Markdown
Member

@rhvgoyal makes sense to me

LGTM

@crosbymichael

Copy link
Copy Markdown
Contributor

LGTM

@crosbymichael
crosbymichael merged commit 0d03c06 into moby:master Sep 6, 2016
@thaJeztah thaJeztah added this to the 1.13.0 milestone Sep 26, 2016
@thaJeztah thaJeztah mentioned this pull request Oct 19, 2016
shishir-a412ed pushed a commit to shishir-a412ed/docker that referenced this pull request Jan 27, 2017
…ries.

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: Shishir Mahajan <[email protected]>
runcom added a commit to projectatomic/docker that referenced this pull request Jan 27, 2017
Backport moby#26212 moby#26918: Provide a knob dm.xfs_nospace_max_retries.
liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
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 <[email protected]>
Signed-off-by: Wentao Zhang <[email protected]>
Cherry-picked from moby#26212

Conflicts:
	daemon/graphdriver/devmapper/deviceset.go
	docs/reference/commandline/daemon.md
liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
Cherry pick devmapper relative commits from master branch

Merge 5 commits:

<a href="/docker/docker/commit/4f0017b9ad7dfa2e9dcdee69d000b98595893e60" data-original="4f0017b9" data-project="7713" data-commit="4f0017b9ad7dfa2e9dcdee69d000b98595893e60" data-reference-type="commit" title="Commit: Vivek Goyal - devmapper: Provide a knob dm.xfs_nospace_max_retries" class="gfm gfm-commit">4f0017b9</a>     <a href="moby#26212" rel="nofollow noreferrer" target="_blank">https://github.com/docker/docker/pull/26212</a><br>
<a href="/docker/docker/commit/55a9b8123d7e89692b5c25c846cf6707a8ce463a" data-original="55a9b812" data-project="7713" data-commit="55a9b8123d7e89692b5c25c846cf6707a8ce463a" data-reference-type="commit" title="Commit: Vivek Goyal - Export Mininum Thin Pool Free Space through docker info" class="gfm gfm-commit">55a9b812</a>     <a href="moby#21945" rel="nofollow noreferrer" target="_blank">https://github.com/docker/docker/pull/21945</a><br>
288f933     <a href="moby#28500" rel="nofollow noreferrer" target="_blank">https://github.com/docker/docker/pull/28500</a><br>
 


d4a2bcc  moby#23974

6cc55dd  moby#26378  
41c6083   moby#26918  






Signed-off-by: Wentao Zhang <a href="mailto:[email protected]">[email protected]</a>


See merge request docker/docker!281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants