summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-10-17 09:10:07 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 17:18:45 +0200
commit7762f5a0b709b415fda132258ad37b9f2a1db994 (patch)
tree7eb1b54dc392f2100bf2cf1e407a2480a4680e7d
parent[PATCH] fuse: fix hang on SMP (diff)
downloadlinux-7762f5a0b709b415fda132258ad37b9f2a1db994.tar.xz
linux-7762f5a0b709b415fda132258ad37b9f2a1db994.zip
[PATCH] document i_size_write locking rules
Unless someone reads the documentation for write_seqcount_{begin,end} it is not obvious, that i_size_write() needs locking. Especially, that lack of such locking can result in a system hang. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/fs.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed467c3..661c7c572149 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -656,7 +656,11 @@ static inline loff_t i_size_read(struct inode *inode)
#endif
}
-
+/*
+ * NOTE: unlike i_size_read(), i_size_write() does need locking around it
+ * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
+ * can be lost, resulting in subsequent i_size_read() calls spinning forever.
+ */
static inline void i_size_write(struct inode *inode, loff_t i_size)
{
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)