On Sun, Sep 26, 2021 at 03:55:07PM +0800, Ming Lei wrote: > There isn't such sync for strlcpy, blkcg_set_fc_appid is called from > sysfs attribute write, and cgroup_id is specified on the write buffer, > so cmpxchg is needed. Also the comment in blkcg_set_fc_appid() explained > that: > > /* > * There is a slight race condition on setting the appid. > * Worst case an I/O may not find the right id. > * This is no different from the I/O we let pass while obtaining > * the vmid from the fabric. > * Adding the overhead of a lock is not necessary. > */ But it isn't really a good idea. If you have e.g. IDs with a shared prefix this will lead to incorrect results. I think we need a proper locking or RCU scheme here, which should also give you the dynamic allocation and freeing for free.