On 3/31/20 12:05 AM, Xiaoguang Wang wrote: > While diving into iouring fileset resigster/unregister/update codes, > we found one bug in fileset update codes. Iouring fileset update codes > use a percpu_ref variable to check whether can put previous registered > file, only when the refcnt of the perfcpu_ref variable reachs zero, can > we safely put these files, but this do not work well. If applications > always issue requests continually, this perfcpu_ref will never have an > chance to reach zero, and it'll always be in atomic mode, also will > defeat the gains introduced by fileset register/unresiger/update feature, > which are used to reduce the atomic operation overhead of fput/fget. > > To fix this issue, while applications do IORING_REGISTER_FILES or > IORING_REGISTER_FILES_UPDATE operations, we allocate a new percpu_ref > and kill the old percpu_ref, new requests will use the new percpu_ref. > Once all previous old requests complete, old percpu_refs will be dropped > and registered files will be put safely. Looks good to me! This is a nice improvement, applied for 5.7. Thanks. -- Jens Axboe