vzctl chkpnt: workaround for ENOSPC

In order to be able to checkpoint/restore processes having opened
but deleted files, we have a kernel helper that hardlinks such files
to a special CPT_HARDLINK_DIR (see commit 16ee8dd).

The problem is if there is no disk space (or disk inodes) available,
checkpointing fails like this:

 # vzctl chkpnt 74933 --dump --dumpfile /dev/shm/dump.74933
 Setting up checkpoint...
 	join context..
	dump...
 Unable to create hardlink directory //.cpt_hardlink_dir_a920e4ddc233afddc9fb53d26c392319: No space left on device
 Checkpointing failed

The workaround, implemented by this patch, is to
 1. Not remove the CPT_HARDLINK_DIR (just remove its contents)
 2. Create CPT_HARDLINK_DIR on container start (chances are
    there is enough free disk space/inodes at that moment)

Unfortunately, it is not helping with the case then there's not enough
inodes as the kernel will fail to hardlink files.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2 files changed