[PATCH] ubifs: atomically set inode->i_flags in ubifs_set_inode_flags()

Zhang Zhen zhenzhang.zhang at huawei.com
Tue Apr 15 19:09:32 PDT 2014


On 2014/4/15 21:31, Artem Bityutskiy wrote:
> On Tue, 2014-04-15 at 14:15 +0800, Zhang Zhen wrote:
>> Use set_mask_bits() to atomically set i_flags instead of clearing out the
>> S_IMMUTABLE, S_APPEND, etc. flags and then setting them from the
>> UBIFS_IMMUTABLE, UBIFS_APPEND_FL, etc. flags, since this opens up a race
>> where an immutable file has the immutable flag cleared for a brief
>> window of time.
>>
>> Signed-off-by: Zhang Zhen <zhenzhang.zhang at huawei.com>
> 
> Looks correct to me. Does it fix a real-life bug or just a hypothetical
> issue? Also, did you test it?
> 
Hi,

It's just a hypothetical issue.

I noticed the commit 00a1a053ebe5febcfc2ec498bd894f035ad2aa06 added the function
set_mask_bits() to atomically set i_flags, and it is also useful to UBIFS.
So i fix it.

Sorry, Because of lacking of test board, i can only guarantee that it has no compile error.

Best regards!





More information about the linux-mtd mailing list