[CRIU] [PATCH 06/15] tty: Restore tty params synchronously

Cyrill Gorcunov gorcunov at gmail.com
Fri Sep 7 19:18:27 MSK 2018


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.

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

diff --git a/criu/tty.c b/criu/tty.c
index 9d65e0d54a53..0f2a289d678a 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -927,7 +927,7 @@ static int restore_tty_params(int fd, struct tty_info *info)
 		}
 	}
 
-	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);
 }
 
 /*
-- 
2.17.1



More information about the CRIU mailing list