From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Rostedt Subject: [PATCH RT 17/25][RFC 3.0.23-rt39-rc1] fs: Protect open coded isize seqcount Date: Tue, 06 Mar 2012 11:16:53 -0500 Message-ID: <20120306161950.551018426@goodmis.org> References: <20120306161636.491172179@goodmis.org> Cc: Thomas Gleixner , Carsten Emde , John Kacur , stable-rt@vger.kernel.org To: linux-kernel@vger.kernel.org, linux-rt-users Return-path: Content-Disposition: inline; filename=0017-fs-Protect-open-coded-isize-seqcount.patch Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-rt-users.vger.kernel.org From: Thomas Gleixner 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 Cc: stable-rt@vger.kernel.org Signed-off-by: Steven Rostedt --- 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