Skip to contentSkip to conversation

fs/ufs/super.c: remove CONFIG_SMP/CONFIG_PREEMPT testing

PATCH In review Fabian Frederick 2 participants 2 messages Feb 1, 2015 – Feb 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ufs/super.c: remove CONFIG_SMP/CONFIG_PREEMPT testing

Let locking subsystem decide on mutex management.

Cc Evgeniy Dushistov <[email protected]>
Cc Andrew Morton <[email protected]>
---
 fs/ufs/super.c | 4 ----
 1 file changed, 4 deletions(-)
fs/ufs/super.c +0 -4
index e515e99..8092d37 100644
@@ -95,22 +95,18 @@
 
 void lock_ufs(struct super_block *sb)
 {
-#if defined(CONFIG_SMP) || defined (CONFIG_PREEMPT)
 	struct ufs_sb_info *sbi = UFS_SB(sb);
 
 	mutex_lock(&sbi->mutex);
 	sbi->mutex_owner = current;
-#endif
 }
 
 void unlock_ufs(struct super_block *sb)
 {
-#if defined(CONFIG_SMP) || defined (CONFIG_PREEMPT)
 	struct ufs_sb_info *sbi = UFS_SB(sb);
 
 	sbi->mutex_owner = NULL;
 	mutex_unlock(&sbi->mutex);
-#endif
 }
 
 static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
Signature · 1 line
2.1.0
#1 lore raw
Quoted 7 lines · On Sun, 1 Feb 2015 12:36:57 +0100 Fabian Frederick <[email protected]> wrote:

Let locking subsystem decide on mutex management.

...

fs/ufs/super.c line 102

Quoted 10 lines
fs/ufs/super.c +0 -2
@@ -95,22 +95,18 @@
 
 void lock_ufs(struct super_block *sb)
 {
-#if defined(CONFIG_SMP) || defined (CONFIG_PREEMPT)
 	struct ufs_sb_info *sbi = UFS_SB(sb);
 
 	mutex_lock(&sbi->mutex);
 	sbi->mutex_owner = current;
-#endif
 }

Good heavens.

This patch is a bugfix. lock_ufs() is assuming that on non-preempt uniprocessor, the calling code will run atomically up to the matching unlock_ufs().

But that isn't true. The very first site I looked at (ufs_frag_map) does sb_bread() under lock_ufs(. And sb_bread() will call schedule(), very commonly.

The ->mutex_owner stuff is a bit hacky but should work OK.

Care to resend the patch with a more alarming changelog?