[CRIU] [PATCH] criu: tty -- Restore tty params synchronously

Cyrill Gorcunov gorcunov at gmail.com
Thu Apr 21 07:10:46 PDT 2016


Async call to do_restore_tty_parms may have a side effect -- the caller
doesn't wait for its completion and continue processing tty associated
with the fd. userns_call carries own copy of file descriptor and if
main code in tty fails then both slave and master may be closed
and only one file descriptor remains: the one which userns carries,
but the terminal already dead, so when we call do_restore_tty_parms
on it we get -EIO.

Thus simply run params restoration on peers in sync'ed way when we
know terminal peers both exist and valid.

https://jira.sw.ru/browse/PSBM-46382

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/tty.c b/criu/tty.c
index 68d7ba3..430a2c8 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -786,7 +786,7 @@ static int restore_tty_params(int fd, struct tty_info *info)
 		winsize_copy(&p.w, info->tie->winsize);
 	}
 
-	return userns_call(do_restore_tty_parms, UNS_ASYNC, &p, sizeof(p), fd);
+	return userns_call(do_restore_tty_parms, 0, &p, sizeof(p), fd);
 }
 
 static int pty_open_slaves(struct tty_info *info)
-- 
2.5.5



More information about the CRIU mailing list