Re: [PATCH] ceph: fix leaked inode reference on writeback abort at umount

Xiubo Li <[email protected]>
Newsgroups org.kernel.vger.ceph-devel,org.kernel.vger.linux-kernel
Message-ID <CAOJNxRKEvZ4eTGv_-_VL7=G3DSs08zzmnrpyJiUhYp6aSi2qCg@mail.gmail.com>
> Only the locked_pages loop is changed here. The preceding fbatch loop is > deliberately left alone...

The refcounting analysis and the fix look correct to me. In
particular, the claim needs to be dropped before
redirty_page_for_writepage(), otherwise ceph_dirty_folio() can observe
an already-claimed folio and create an extra wrbuffer reference
without taking another inode reference.

One thing I'd like to clarify is why the locked_pages entries are
guaranteed to own the claim being undone, while the entries handled
through fbatch may still belong to another in-flight write. This seems
to be the key distinction for why ceph_process_folio_batch() is
intentionally left unchanged. Assuming that ownership distinction is
guaranteed by the locking/state transitions, the fix looks good to me.

Thanks
Xiubo Li
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.