Commit 153d182f authored by Russell Cattelan's avatar Russell Cattelan Committed by Christoph Hellwig

[XFS] make *cmn_err interrupt safe

SGI Modid: 2.5.x-xfs:slinx:136126a
parent 89e49671
...@@ -86,12 +86,13 @@ cmn_err(register int level, char *fmt, ...) ...@@ -86,12 +86,13 @@ cmn_err(register int level, char *fmt, ...)
{ {
char *fp = fmt; char *fp = fmt;
int len; int len;
int flags;
va_list ap; va_list ap;
level &= XFS_ERR_MASK; level &= XFS_ERR_MASK;
if (level > XFS_MAX_ERR_LEVEL) if (level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL; level = XFS_MAX_ERR_LEVEL;
spin_lock(&xfs_err_lock); spin_lock_irqsave(&xfs_err_lock,flags);
va_start(ap, fmt); va_start(ap, fmt);
if (*fmt == '!') fp++; if (*fmt == '!') fp++;
len = vsprintf(message, fp, ap); len = vsprintf(message, fp, ap);
...@@ -99,7 +100,7 @@ cmn_err(register int level, char *fmt, ...) ...@@ -99,7 +100,7 @@ cmn_err(register int level, char *fmt, ...)
strcat(message, "\n"); strcat(message, "\n");
printk("%s%s", err_level[level], message); printk("%s%s", err_level[level], message);
va_end(ap); va_end(ap);
spin_unlock(&xfs_err_lock); spin_unlock_irqrestore(&xfs_err_lock,flags);
if (level == CE_PANIC) if (level == CE_PANIC)
BUG(); BUG();
...@@ -110,15 +111,16 @@ void ...@@ -110,15 +111,16 @@ void
icmn_err(register int level, char *fmt, va_list ap) icmn_err(register int level, char *fmt, va_list ap)
{ {
int len; int len;
int flags;
level &= XFS_ERR_MASK; level &= XFS_ERR_MASK;
if(level > XFS_MAX_ERR_LEVEL) if(level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL; level = XFS_MAX_ERR_LEVEL;
spin_lock(&xfs_err_lock); spin_lock_irqsave(&xfs_err_lock,flags);
len = vsprintf(message, fmt, ap); len = vsprintf(message, fmt, ap);
if (message[len-1] != '\n') if (message[len-1] != '\n')
strcat(message, "\n"); strcat(message, "\n");
spin_unlock(&xfs_err_lock); spin_unlock_irqrestore(&xfs_err_lock,flags);
printk("%s%s", err_level[level], message); printk("%s%s", err_level[level], message);
if (level == CE_PANIC) if (level == CE_PANIC)
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment