Whamcloud - gitweb
LU-588 ldiskfs: Don't release super block buffer_head too early
If the super block buffer_head is released prior to MMP stopping
kmmpd can get a zeroed buffer_head and exit. The following code
causes kmmpd to exit when the s_feature_incompat is zero:
if (!(le32_to_cpu(es->s_feature_incompat) &
LDISKFS_FEATURE_INCOMPAT_MMP)) {
ldiskfs_warning(sb, "kmmpd being stopped since MMP feature"
" has been disabled.");
LDISKFS_SB(sb)->s_mmp_tsk = NULL;
goto failed;
}
A deadlock can occur with the kthread_stop_lock mutex because
ldiskfs_put_super calls kthread_stop on an already stopped thread
(kmmpd) so it waits for completion of the thread stopping before
releasing the kthread_stop_lock.
This is the result of a race with the kmmpd thread setting s_mmp_tsk
to NULL and ldiskfs_put_super in another thread to checks s_mmp_tsk
for NULL prior to calling kthread_stop.
Signed-off-by: Jeremy Filizetti <jeremy.filizetti@gmail.com>
Change-Id: Ia15d8ff829705a5d51dea4f86e40ba7c5745a9c5
Reviewed-on: http://review.whamcloud.com/3172
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>