Commit 0921835c authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix to avoid call kvfree under spinlock

vfree() don't wish to be called from interrupt context, move it
out of spin_lock_irqsave() coverage.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 280fd422
...@@ -1640,6 +1640,7 @@ static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) ...@@ -1640,6 +1640,7 @@ static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f)
static inline void disable_nat_bits(struct f2fs_sb_info *sbi, bool lock) static inline void disable_nat_bits(struct f2fs_sb_info *sbi, bool lock)
{ {
unsigned long flags; unsigned long flags;
unsigned char *nat_bits;
/* /*
* In order to re-enable nat_bits we need to call fsck.f2fs by * In order to re-enable nat_bits we need to call fsck.f2fs by
...@@ -1650,10 +1651,12 @@ static inline void disable_nat_bits(struct f2fs_sb_info *sbi, bool lock) ...@@ -1650,10 +1651,12 @@ static inline void disable_nat_bits(struct f2fs_sb_info *sbi, bool lock)
if (lock) if (lock)
spin_lock_irqsave(&sbi->cp_lock, flags); spin_lock_irqsave(&sbi->cp_lock, flags);
__clear_ckpt_flags(F2FS_CKPT(sbi), CP_NAT_BITS_FLAG); __clear_ckpt_flags(F2FS_CKPT(sbi), CP_NAT_BITS_FLAG);
kvfree(NM_I(sbi)->nat_bits); nat_bits = NM_I(sbi)->nat_bits;
NM_I(sbi)->nat_bits = NULL; NM_I(sbi)->nat_bits = NULL;
if (lock) if (lock)
spin_unlock_irqrestore(&sbi->cp_lock, flags); spin_unlock_irqrestore(&sbi->cp_lock, flags);
kvfree(nat_bits);
} }
static inline bool enabled_nat_bits(struct f2fs_sb_info *sbi, static inline bool enabled_nat_bits(struct f2fs_sb_info *sbi,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment