unsigned char stop_reason[MAX_STOP_REASON]; /* stop reason */
spinlock_t error_lock; /* protect errors/stop_reason array */
bool error_dirty; /* errors of sb is dirty */
+ bool stop_reason_dirty; /* stop reason of sb is dirty */
/* For reclaimed segs statistics per each GC mode */
unsigned int gc_segment_mode; /* GC state for reclaimed segments */
spin_lock_irqsave(&sbi->error_lock, flags);
if (sbi->stop_reason[reason] < GENMASK(BITS_PER_BYTE - 1, 0))
sbi->stop_reason[reason]++;
+ sbi->stop_reason_dirty = true;
spin_unlock_irqrestore(&sbi->error_lock, flags);
}
{
struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
unsigned long flags;
+ bool report_shutdown = false;
int err;
f2fs_down_write(&sbi->sb_lock);
sbi->error_dirty = false;
}
memcpy(raw_super->s_stop_reason, sbi->stop_reason, MAX_STOP_REASON);
+ if (sbi->stop_reason_dirty) {
+ report_shutdown = true;
+ sbi->stop_reason_dirty = false;
+ }
spin_unlock_irqrestore(&sbi->error_lock, flags);
err = f2fs_commit_super(sbi, false);
"f2fs_commit_super fails to record stop_reason, err:%d",
err);
- fserror_report_shutdown(sbi->sb, GFP_NOFS);
+ if (report_shutdown)
+ fserror_report_shutdown(sbi->sb, GFP_NOFS);
}
void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)