RE: [PATCH] fs/ceph/io: make ceph_start_io_*() killable

From: Viacheslav Dubeyko
Date: Mon Dec 09 2024 - 14:04:57 EST


On Fri, 2024-12-06 at 23:48 +0100, Max Kellermann wrote:
> On Fri, Dec 6, 2024 at 8:11 PM Viacheslav Dubeyko
> <Slava.Dubeyko@xxxxxxx> wrote:
> > Should be the check of
> > this function's output mandatory? I am not fully sure.
>
> But I am fully sure.
> If you don't check the return value, you don't know whether the inode
> was locked. If you don't know that, you can't decide whether you need
> to unlock it. That being optional now (cancel locking if SIGKILL was
> received) is the sole point of my patch. You MUST check the return
> value. There is no other way. Don't trust my word - just read the
> code.


The down_write_killable() can return -EINTR, currently:
https://elixir.bootlin.com/linux/v6.12.4/source/kernel/locking/rwsem.c#L1593

And -EINTR can imply that client has been killed:
https://elixir.bootlin.com/linux/v6.12.4/source/include/uapi/asm-generic/errno-base.h#L8

It sounds to me that we simply need not to execute the logic. But do we
really need to report
the error to the caller? I am simply trying to double check that
caller's logic is ready
to process the error condition in the correct way.

Thanks,
Slava.