On Sat, Apr 03, 2021 at 04:10:16PM +0800, Ming Lei wrote: > We still may shutdown blktrace if current is the last opener, otherwise > new blktrace can't be started and memory should be leaked forever, and > what do you think of the revised version? I don't think this works. For one there might be users of the blktrace ioctl that explicitly rely on this not happening as difference processes might start the tracing vs actually consume the trace data. Second this might not actually work as another process could be the last opener. If you want to fix this for the blktrace tool (common) case I think we need a new ioctl that explicitly ties the buffer lifetime to the fd.