https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285394

--- Comment #19 from Andriy Gapon <a...@freebsd.org> ---
I've got some time for more experiments last weekend and I must admit that the
basic premise of this bug report was false.
I assumed that in my environment the console-kit daemon opened /dev/tty for
some reason, but the assumption was wrong.

console-kit-daemon actually opens /dev/console.
And initially it works fine, but then somehow it gets broken.

  3304 100948 console-kit-daemon 0.000021448 CALL 
openat(AT_FDCWD,0x207f70,0x8000<O_RDONLY|O_NOCTTY>)
  3304 100948 console-kit-daemon -0.000131032 NAMI  "/dev/tty"
  3304 100948 console-kit-daemon 0.000059309 RET   openat -1 errno 6 Device not
configured
  3304 100948 console-kit-daemon 0.000035080 CALL 
openat(AT_FDCWD,0x207f70,0x8000<O_RDONLY|O_NOCTTY>)
  3304 100948 console-kit-daemon 0.000030242 NAMI  "/dev/tty"
  3304 100948 console-kit-daemon 0.000100756 RET   openat -1 errno 6 Device not
configured
  3304 100948 console-kit-daemon 0.000129217 CALL 
openat(AT_FDCWD,0x20cc60,0x8000<O_RDONLY|O_NOCTTY>)
  3304 100948 console-kit-daemon 0.000023367 NAMI  "/dev/tty0"
  3304 100948 console-kit-daemon -0.000070810 RET   openat -1 errno 2 No such
file or directory
  3304 100948 console-kit-daemon -0.000327167 CALL 
openat(AT_FDCWD,0x20b782,0x8000<O_RDONLY|O_NOCTTY>)
  3304 100948 console-kit-daemon -0.000032761 NAMI  "/dev/console"
  3304 100948 console-kit-daemon 0.000038416 RET   openat 12/0xc
  3304 100948 console-kit-daemon 0.000070820 CALL 
ioctl(0xc,CONS_GETVERS,0x8209b2934)
  3304 100948 console-kit-daemon 0.000035115 RET   ioctl 0
  3304 100948 console-kit-daemon -0.000028165 CALL 
ioctl(0xc,TIOCGETA,0x8209b28e4)
  3304 100948 console-kit-daemon 0.000091327 RET   ioctl 0
  3304 100948 console-kit-daemon 0.000029932 CALL 
ioctl(0xc,VT_GETACTIVE,0x8209b296c)
  3304 100948 console-kit-daemon -0.000070518 RET   ioctl 0

But after a while:
  3304 101052 vt_thread_start -0.000074544 CALL  ioctl(0xc,VT_WAITACTIVE,0x9)
  3304 101052 vt_thread_start 0.000201533 RET   ioctl -1 errno 25 Inappropriate
ioctl for device

Because console-kit-daemon keeps the descriptor open I was able to examine it
and the corresponding vnode with kgdb.
$1 = {f_flag = 1, f_count = 9, f_data = 0xfffff80002c27400, f_ops =
0xffffffff80f2d4b0 <devfs_ops_f>, f_vnode = 0xfffff8001e2ac8c0, f_cred =
0xfffff80298ee6100, f_type = 1, f_vnread_flags = 0, {f_seqcount = {0, 0},
f_pipegen = 0}, f_nextoff = {0, 0}, f_vnun = {fvn_cdevpriv = 0x0, fvn_advice =
0x0}, f_offset = 0}

$2 = {v_type = VBAD, v_state = VSTATE_DEAD, v_irflag = 1, v_seqc = 1, v_nchash
= 1355928945, v_hash = 1977032, v_op = 0xffffffff8127a5c8 <dead_vnodeops>,
v_data = 0x0, v_mount = 0x0, v_nmntvnodes = {tqe_next = 0xfffff8001cd03e00,
tqe_prev = 0xfffff8001ce2c028}, {v_mountedhere = 0x0, v_unpcb = 0x0, v_rdev =
0x0, v_fifoinfo = 0x0}, v_hashlist = {le_next = 0x0, le_prev = 0x0},
v_cache_src = {lh_first = 0x0}, v_cache_dst = {tqh_first = 0x0, tqh_last =
0xfffff8001e2ac918}, v_cache_dd = 0x0, v_lock = {lock_object = {lo_name =
0xffffffff80d1cf3c "devfs", lo_flags = 116588544, lo_data = 0, lo_witness =
0x0}, lk_lock = 1, lk_exslpfail = 0, lk_pri = 64, lk_timo = 51}, v_interlock =
{lock_object = {lo_name = 0xffffffff80db24c1 "vnode interlock", lo_flags =
16973824, lo_data = 0, lo_witness = 0x0}, mtx_lock = 0}, v_vnlock =
0xfffff8001e2ac930, v_vnodelist = {tqe_next = 0xfffff8001e494e00, tqe_prev =
0xfffff8001e33e0c0}, v_lazylist = {tqe_next = 0x0, tqe_prev = 0x0}, v_bufobj =
{bo_lock = {lock_object = {lo_name = 0xffffffff80df4394 "bufobj interlock",
lo_flags = 86179840, lo_data = 0, lo_witness = 0x0}, rw_lock = 1}, bo_ops =
0xffffffff812b7190 <buf_ops_bio>, bo_object = 0x0, bo_synclist = {le_next =
0x0, le_prev = 0x0}, bo_private = 0xfffff8001e2ac8c0, bo_clean = {bv_hd =
{tqh_first = 0x0, tqh_last = 0xfffff8001e2ac9e8}, bv_root = {pt_root = 0x1},
bv_cnt = 0}, bo_dirty = {bv_hd = {tqh_first = 0x0, tqh_last =
0xfffff8001e2aca08}, bv_root = {pt_root = 0x1}, bv_cnt = 0}, bo_numoutput = 0,
bo_flag = 4, bo_domain = 2, bo_bsize = 512}, v_pollinfo = 0x0, v_label = 0x0,
v_lockf = 0x0, v_rl = {rl_waiters = {tqh_first = 0x0, tqh_last =
0xfffff8001e2aca50}, rl_currdep = 0x0}, v_holdcnt = 1, v_usecount = 2, v_iflag
= 0, v_vflag = 10, v_mflag = 0, v_dbatchcpu = -1, v_writecount = 1,
v_seqc_users = 1}

The descriptor is open, the (devfs) vnode is in use, but it has been "recycled"
and is no longer usable.

It's hard for me to imagine what caused that.
Perhaps, a revoke(2) system call -- but why would anything call it? -- or maybe
some sort of devfs "re-mount".

Anyways, since console-kit already uses /dev/console, my patch is most likely
moot.
There is something stranger going on.
Maybe something specific to my environment.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to