[PATCH v5.4 and earlier] trace: Fix race in trace_open and buffer resize call