devmapper: Provide a knob dm.xfs_nospace_max_retries
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 <61d11262d0d9873ddb5a887f48fcb04e8c5973d0@redhat.com>

allencloud/cli,e11137/cli,dnephin/cli,dnephin/cli,e11137/cli,allencloud/cli,Zebrilee/cli,Zebrilee/cli,ashfall/cli,ashfall/cli,redpanda/cli,cpuguy83/cli,thaJeztah/cli,redpanda/cli,docker/cli,thaJeztah/cli,riyazdf/cli,cpuguy83/cli,docker/cli,riyazdf/cli