Re: wakeup_pipe_readers/writers() && pipe_poll()

From: Oleg Nesterov
Date: Mon Jan 06 2025 - 14:35:45 EST


Damn ;)

It is amazing how much unnecessary spam I added to these discussions.
But let me ask 2 more questions, hopefully no more.

1. pipe_read() says

* But when we do wake up writers, we do so using a sync wakeup
* (WF_SYNC), because we want them to get going and generate more
* data for us.

OK, WF_SYNC makes sense if pipe_read() or pipe_write() is going to do wait_event()
after wake_up(). But wake_up_interruptible_sync_poll() looks at bit misleading if
we are going to wakeup the writer or next_reader before return.

2. I can't understand this code in pipe_write()

if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) {
int err = file_update_time(filp);
if (err)
ret = err;
sb_end_write(file_inode(filp)->i_sb);
}

- it only makes sense in the "fifo" case, right? When
i_sb->s_magic != PIPEFS_MAGIC...

- why should we propogate the error code if "ret > 0" but
file_update_time() fails?

Oleg.