[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Apparent deadlock in processes interacting with /hurd/fifo
From: |
Ludovic Courtès |
Subject: |
Re: Apparent deadlock in processes interacting with /hurd/fifo |
Date: |
Sat, 26 Nov 2022 16:42:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Hi,
Samuel Thibault <samuel.thibault@gnu.org> skribis:
> Ludovic Courtès, le ven. 25 nov. 2022 12:35:58 +0100, a ecrit:
>> Let’s assume you do this:
>>
>> mkfifo fifo
>> rpctrace cat fifo
>>
>> I think there’s at least one bug here: ‘dir_lookup’ should complete
>> immediately; it’s ‘io_read’ that should block.
>
> ? No. Open Group says about open():
>
> ○ If O_NONBLOCK is clear, an open() for reading-only shall block the
> calling thread until a thread opens the file for writing. An
> open()
> for writing-only shall block the calling thread until a thread
> opens the file for reading.
>
> (and Linux does that indeed)
Indeed, I had overlooked that.
So it seems that the reason ‘df /tmp/fifo’ worked with Coreutils 8.32 on
GNU/Linux is that there it would not try to open the file:
--8<---------------cut here---------------start------------->8---
newfstatat(AT_FDCWD, "/tmp/fifo", {st_mode=S_IFIFO|0644, st_size=0, ...}, 0) = 0
openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 3
newfstatat(3, "", {st_mode=S_IFREG|0444, st_size=0, ...}, AT_EMPTY_PATH) = 0
read(3, "22 25 0:20 / /proc rw,relatime -"..., 1024) = 1024
read(3, "30 / /sys/fs/cgroup/cpuset rw,re"..., 1024) = 1024
read(3, "27308k,nr_inodes=406827,mode=700"..., 1024) = 50
read(3, "", 1024) = 0
lseek(3, 0, SEEK_CUR) = 2098
close(3) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon -echo ...}) = 0
readlink("/tmp", 0x7ffcb94aabf0, 1023) = -1 EINVAL (Invalid argument)
readlink("/tmp/fifo", 0x7ffcb94aabf0, 1023) = -1 EINVAL (Invalid argument)
newfstatat(AT_FDCWD, "/", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
uname({sysname="Linux", nodename="ribbon", ...}) = 0
statfs("/tmp/fifo", {f_type=EXT2_SUPER_MAGIC, f_bsize=4096, f_blocks=121739374,
f_bfree=8850770, f_bavail=2660102, f_files=30932992, f_ffree=23669755,
f_fsid={val=[0x627eb274, 0x360fd8c4]}, f_namelen=255, f_frsize=4096,
f_flags=ST_VALID|ST_RELATIME}) = 0
--8<---------------cut here---------------end--------------->8---
Thanks for your feedback!
Ludo’.