[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGudoHF0+JfqxB_fQxeo7Pbadjq7UA1JFH4QmfFS1hDHunNmtw@mail.gmail.com>
Date: Wed, 17 Sep 2025 16:12:26 +0200
From: Mateusz Guzik <mjguzik@...il.com>
To: Max Kellermann <max.kellermann@...os.com>
Cc: slava.dubeyko@....com, xiubli@...hat.com, idryomov@...il.com,
amarkuze@...hat.com, ceph-devel@...r.kernel.org, netfs@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v2] ceph: fix deadlock bugs by making iput() calls asynchronous
On Wed, Sep 17, 2025 at 3:59 PM Max Kellermann <max.kellermann@...os.com> wrote:
> +/**
> + * Queue an asynchronous iput() call in a worker thread. Use this
> + * instead of iput() in contexts where evicting the inode is unsafe.
> + * For example, inode eviction may cause deadlocks in
> + * inode_wait_for_writeback() (when called from within writeback) or
> + * in netfs_wait_for_outstanding_io() (when called from within the
> + * Ceph messenger).
> + */
> +void ceph_iput_async(struct inode *inode)
> +{
> + if (unlikely(!inode))
> + return;
> +
> + if (likely(atomic_add_unless(&inode->i_count, -1, 1)))
> + /* somebody else is holding another reference -
> + * nothing left to do for us
> + */
> + return;
> +
LGTM, I see the queue thing ends up issuing iput() so it's all good, thanks.
No idea about the other stuff it is doing concerning ceph flags so no comment.
> + doutc(ceph_inode_to_fs_client(inode)->client, "%p %llx.%llx\n", inode, ceph_vinop(inode));
> +
> + /* simply queue a ceph_inode_work() (donating the remaining
> + * reference) without setting i_work_mask bit; other than
> + * putting the reference, there is nothing to do
> + */
> + WARN_ON_ONCE(!queue_work(ceph_inode_to_fs_client(inode)->inode_wq,
> + &ceph_inode(inode)->i_work));
> +
> + /* note: queue_work() cannot fail; it i_work were already
> + * queued, then it would be holding another reference, but no
> + * such reference exists
> + */
> +}
> +
Powered by blists - more mailing lists