Commits
Andrey Mirkin authored and Pavel Emelianov committed 3a1d794fef4
[PATCH] CPT: restore deleted files (hardlink case) The bug was here all the time, but it was never triggered as we never entered the following path on checkpointing: if (!IS_ROOT(d) && d_unhashed(d)) { struct file *parent; parent = iobj->o_parent; if (!parent || (!IS_ROOT(parent->f_dentry) && d_unhashed(parent->f_dentry))) { /* Inode is not deleted, but it does not * have references from inside checkpointed * process group. We have options: * A. Fail, abort checkpointing * B. Proceed. File will be cloned. * A is correct, B is more complicated */ /* Just as a hint where to create deleted file */ if (ino->i_nlink != 0) { eprintk_ctx("deleted reference to existing inode, checkpointing is impossible\n"); return -EBUSY; } } else { <<< HERE /* Refer to _another_ file name. */ err = cpt_dump_filename(parent, 0, ctx); if (err) return err; if (S_ISREG(ino->i_mode) || S_ISDIR(ino->i_mode)) dump_it = 0; } } So, in image file for deleted file we always had its content and never a reference to another file. The fix is straightforward: check the type of the object in the image and restore file content if needed.