Messages in this thread Patch in this message | | | Date | Fri, 30 Jan 2004 15:13:16 -0800 | From | Andrew Morton <> | Subject | Re: 2.6.2-rc2 nfsd+xfs spins in i_size_read() |
| |
Christoph Hellwig <hch@infradead.org> wrote: > > On Fri, Jan 30, 2004 at 02:34:59PM -0800, Andrew Morton wrote: > > If two CPUs hit i_size_write() at the same time we have a bug. That > > function requires that the caller provide external serialisation, via i_sem. > > O_APPEND|O_DIRECT writes could do that under XFS..
Sigh.
diff -puN include/linux/fs.h~i_size_write-check include/linux/fs.h --- 25/include/linux/fs.h~i_size_write-check Fri Jan 30 15:09:47 2004 +++ 25-akpm/include/linux/fs.h Fri Jan 30 15:10:28 2004 @@ -464,9 +464,11 @@ static inline loff_t i_size_read(struct #endif } +void i_size_write_check(struct inode *inode); static inline void i_size_write(struct inode *inode, loff_t i_size) { + i_size_write_check(inode); #if BITS_PER_LONG==32 && defined(CONFIG_SMP) write_seqcount_begin(&inode->i_size_seqcount); inode->i_size = i_size; diff -puN mm/filemap.c~i_size_write-check mm/filemap.c --- 25/mm/filemap.c~i_size_write-check Fri Jan 30 15:10:23 2004 +++ 25-akpm/mm/filemap.c Fri Jan 30 15:11:41 2004 @@ -2010,3 +2010,18 @@ out: } EXPORT_SYMBOL_GPL(generic_file_direct_IO); + +void i_size_write_check(struct inode *inode) +{ + static int count = 0; + + if (down_trylock(&inode->i_sem) == 0) { + if (count < 10) { + count++; + printk("i_size_write() called without i_sem\n"); + dump_stack(); + } + up(&inode->i_sem); + } +} +EXPORT_SYMBOL(i_size_write_check); _
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |