Re: [PATCH] PowerPC: honor O_NONBLOCK flag for rtas error_log

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Vitaly Mayatskikh <v.mayatskih@...>
Cc: <linux-kernel@...>, Anton Blanchard <anton@...>, Paul Mackerras <paulus@...>
Date: Friday, July 4, 2008 - 9:12 am

Vitaly Mayatskikh <v.mayatskih@gmail.com> writes:


Sorry, wrong patch :(

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>

diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index 7d3e2b0..3343211 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -291,21 +291,24 @@ static ssize_t rtas_log_read(struct file * file, char __user * buf,
 	if (!access_ok(VERIFY_WRITE, buf, count))
 		return -EFAULT;
 
-	tmp = kmalloc(count, GFP_KERNEL);
-	if (!tmp)
-		return -ENOMEM;
-
-
 	spin_lock_irqsave(&rtasd_log_lock, s);
 	/* if it's 0, then we know we got the last one (the one in NVRAM) */
-	if (rtas_log_size == 0 && logging_enabled)
+	if (rtas_log_size == 0 && logging_enabled) {
 		nvram_clear_error_log();
+		if (file->f_flags & O_NONBLOCK) {
+			spin_unlock_irqrestore(&rtasd_log_lock, s);
+			return -EAGAIN;
+		}
+	}
 	spin_unlock_irqrestore(&rtasd_log_lock, s);
 
-
 	error = wait_event_interruptible(rtas_log_wait, rtas_log_size);
 	if (error)
-		goto out;
+		return error;
+
+	tmp = kmalloc(count, GFP_KERNEL);
+	if (!tmp)
+		return -ENOMEM;
 
 	spin_lock_irqsave(&rtasd_log_lock, s);
 	offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK);

-- 
wbr, Vitaly
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] PowerPC: honor O_NONBLOCK flag for rtas error_log, Vitaly Mayatskikh, (Fri Jul 4, 9:06 am)
Re: [PATCH] PowerPC: honor O_NONBLOCK flag for rtas error_log, Vitaly Mayatskikh, (Fri Jul 4, 9:12 am)