cr-dump: discover fs type in fill_fd_params_special

Submitted by Stanislav Kinsburskiy on June 30, 2016, 4:49 p.m.

Details

Message ID 20160630164842.519079.2433.stgit@skinsbursky-vz7-gold.qa.sw.ru
State Accepted
Series "cr-dump: discover fs type in fill_fd_params_special"
Commit d1bb42c1bf566b405e96dd895ce7708a2a17ef31
Headers show

Commit Message

Stanislav Kinsburskiy June 30, 2016, 4:49 p.m.
FS type is required to distinguish between local files and remove ones, which
will be restored via SPFS and thus has to be created first.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 criu/cr-dump.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index ffa57d5..64fa99e 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -229,6 +229,8 @@  static int collect_fds(pid_t pid, struct parasite_drain_fd **dfds)
 
 static int fill_fd_params_special(int fd, struct fd_parms *p)
 {
+	struct statfs fst;
+
 	*p = FD_PARMS_INIT;
 
 	if (fstat(fd, &p->stat) < 0) {
@@ -239,6 +241,13 @@  static int fill_fd_params_special(int fd, struct fd_parms *p)
 	if (get_fd_mntid(fd, &p->mnt_id))
 		return -1;
 
+	if (fstatfs(fd, &fst)) {
+		pr_perror("Unable to statfs fd %d", fd);
+		return -1;
+	}
+
+	p->fs_type = fst.f_type;
+
 	return 0;
 }
 

Comments

Pavel Emelianov July 4, 2016, 6:08 p.m.
Applied