[06/15] tty: Restore tty params synchronously

Submitted by Cyrill Gorcunov on Sept. 7, 2018, 4:18 p.m.

Details

Message ID 20180907161836.25738-7-gorcunov@gmail.com
State Accepted
Series "tty: Add support for multiple devtps instances"
Headers show

Commit Message

Cyrill Gorcunov Sept. 7, 2018, 4:18 p.m.
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@gmail.com>
---
 criu/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);
 }
 
 /*