[CRIU] [PATCH 0/3] mount: Improve restore of deleted bindmounts

Pavel Emelyanov xemul at parallels.com
Wed Sep 2 05:35:40 PDT 2015


Both applied, thanks. Two questions still stands though :)

> +			if (S_ISDIR(st.st_mode)) {
> +				if (mkdir(root, (st.st_mode & ~S_IFMT))) {
> +					pr_perror("Can't re-create deleted directory %s\n", root);
> +					return -1;
> +				}
> +			} else if (S_ISREG(st.st_mode)) {
> +				if (open(root, O_WRONLY | O_CREAT | O_TRUNC, (st.st_mode & ~S_IFMT)) < 0) {
> +					pr_perror("Can't re-create deleted file %s\n", root);
> +					return -1;
> +				}

If directory exists, then mkdir() would fail. But if file exists open()
would not fail. But it probably should, how about adding O_EXCL to flags?

And question number 2 -- is it good or bad that we leak a file descriptor
after open()?

-- Pavel


More information about the CRIU mailing list