On Wed, Mar 06, 2024 at 08:52:41AM +0800, Peter Xu wrote: > On Tue, Mar 05, 2024 at 05:49:33PM +0000, Daniel P. Berrangé wrote: > > I don't think you should be removing this. Calling qio_channel_close() > > remains recommended best practice, even with fdatasync() removed, as > > it provides a strong guarantee that the FD is released which you don't > > get if you rely on the ref count being correctly decremented in all > > code paths. > > Hmm, I have the confusion on why ioc->fd is more special than the ioc > itself when leaked. It'll be a bug anyway if we leak any of them? Leaking > fds may also help us to find such issue easier (e.g. by seeing stale fds > under /proc). From that POV I tend to agree on the original proposal.
Closing the FD would cause any registered I/O handlers callbacks to get POLLNVAL and may well trigger cleanup that will prevent the leak. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|