Patch "fs/super.c: fix race between freeze_super() and thaw_super()" has been added to the 3.18-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
fs/super.c: fix race between freeze_super() and thaw_super()
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
fs-super.c-fix-race-between-freeze_super-and-thaw_super.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
89f39af129382a40d7cd1f6914617282cfeee28eMon Sep 17 00:00:00 2001
From: Oleg Nesterov <[email protected]>
Date: Mon, 26 Sep 2016 18:07:48 +0200
Subject: fs/super.c: fix race between freeze_super() and thaw_super()
From: Oleg Nesterov <[email protected]>
commit 89f39af129382a40d7cd1f6914617282cfeee28e upstream.
Change thaw_super() to check frozen != SB_FREEZE_COMPLETE rather than frozen == SB_UNFROZEN, otherwise it can race with freeze_super() which drops sb->s_umount after SB_FREEZE_WRITE to preserve the lock ordering.
In this case thaw_super() will wrongly call s_op->unfreeze_fs() before it was actually frozen, and call sb_freeze_unlock() which leads to the unbalanced percpu_up_write(). Unfortunately lockdep can't detect this, so this triggers misc BUG_ON()'s in kernel/rcu/sync.c.
--- fs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/super.c +3 -3
@@ -1346,8 +1346,8 @@ int freeze_super(struct super_block *sb) } }/* -* This is just for debugging purposes so that fs can warn if it -* sees write activity when frozen is set to SB_FREEZE_COMPLETE. +* For debugging purposes so that fs can warn if it sees write activity +* when frozen is set to SB_FREEZE_COMPLETE, and for thaw_super(). */ sb->s_writers.frozen =SB_FREEZE_COMPLETE ;up_write (&sb->s_umount);
@@ -1366,7 +1366,7 @@ int thaw_super(struct super_block *sb)int error;down_write (&sb->s_umount); -if (sb->s_writers.frozen ==SB_UNFROZEN ) { +if (sb->s_writers.frozen !=SB_FREEZE_COMPLETE ) {up_write (&sb->s_umount);return -EINVAL ; }
Patches currently in stable-queue which might be from [email protected] are
queue-3.18/fs-super.c-fix-race-between-freeze_super-and-thaw_super.patch