Re: [PATCH] block: only allocate blkcg->fc_app_id when starting to use it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux