[patch 02/12] document i_size_write locking rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

---
Index: linux/include/linux/fs.h
===================================================================
--- linux.orig/include/linux/fs.h	2006-10-16 12:53:03.000000000 +0200
+++ linux/include/linux/fs.h	2006-10-16 14:10:22.000000000 +0200
@@ -670,7 +670,11 @@ static inline loff_t i_size_read(struct 
 #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)

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux