Hi Gerg > Because of this text, I am not allowed to respond to your emails, sorry :(
That is my fault! Please let me re-send these message. > This feels "odd", are we sure that open really should be clearning this flag? Because the pty devices also use tty_init_dev(), to create tty_struct , and inside where I set the TTY_HUPPED flag. If don't clean it at the end of ptmx_ope(), new tty_struct created for a ssh connection will have this bit set > What is this barrier() call protecting? Please always comment it so > that we know what is going on in 5 years when we next look at this > code It does not really hung the tty up, just set TTY_HUPPED flag. After the tty structure is generated, a kworker with flush_to_ldisc() would be scheduled to another cpu, not the one who is opening that /dev/tty*. I think a barrier() can ensure the kworker see tty flags change in time. >What keeps the bit from being set now right after checking it? After check, next step is to call tty_ldisc_receive_buf(). If anyone obtains all required locks and modifies terminal or line discipline, while receiving is In processing, it should have another problem. Maybe oops again. I have no idea how to keep the bit being set, but after testing for days, I haven't sawn that happen. Yuhong Tao Huawei Technologies Co., Ltd.