[PATCH] ext2: do not sleep in ext2_error()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No one expects error logging functions to sleep so sometimes they are
called with spinlocks held.  In this case the problematic call tree is:

ext2_statfs() <- disables preempt
-> ext2_count_free_inodes()
   -> ext2_get_group_desc()
      -> ext2_error()

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
This is just from static analysis.  NOT TESTED!

Probably a safer fix would be to just call pr_err() instead of
ext2_error() in ext2_get_group_desc().  I can send that fix instead if
people want.

 fs/ext2/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d8d580b609ba..ba345ab860f0 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -59,7 +59,7 @@ void ext2_error(struct super_block *sb, const char *function,
 		sbi->s_mount_state |= EXT2_ERROR_FS;
 		es->s_state |= cpu_to_le16(EXT2_ERROR_FS);
 		spin_unlock(&sbi->s_lock);
-		ext2_sync_super(sb, es, 1);
+		ext2_sync_super(sb, es, 0);
 	}
 
 	va_start(args, fmt);
-- 
2.20.1




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux