[PATCH RT 17/25][RFC 3.0.23-rt39-rc1] fs: Protect open coded isize seqcount

Steven Rostedt
2012-03-06T16:16:53Z

[-- Attachment #1: 0017-fs-Protect-open-coded-isize-seqcount.patch --]
[-- Type: text/plain, Size: 1015 bytes --]

From: Thomas Gleixner <tglx@linutronix.de>

A writer might be preempted in the write side critical section on
RT. Disable preemption to avoid endless spinning of a preempting
reader.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable-rt@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/fs.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9c85217..c7984a5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -876,9 +876,11 @@ static inline loff_t i_size_read(const struct inode *inode)
static inline void i_size_write(struct inode *inode, loff_t i_size)
{
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
+ preempt_disable_rt();
write_seqcount_begin(&inode->i_size_seqcount);
inode->i_size = i_size;
write_seqcount_end(&inode->i_size_seqcount);
+ preempt_enable_rt();
#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
preempt_disable();
inode->i_size = i_size;
--
1.7.8.3