linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Updated locking documentation for struct inode
@ 2019-03-08 15:04 Alexander Lochmann
  0 siblings, 0 replies; only message in thread
From: Alexander Lochmann @ 2019-03-08 15:04 UTC (permalink / raw)
  Cc: Alexander Viro, linux-fsdevel, linux-kernel, Alexander Lochmann,
	Horst Schirmeier

We used LockDoc to derive locking rules for each member
of struct inode.
Based on those results, we extended the existing documentation
by more members of struct inode, and updated the existing
documentation.

Signed-off-by: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Signed-off-by: Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
---
 fs/inode.c         | 49 ++++++++++++++++++++++++++++++++++++----------
 include/linux/fs.h |  2 +-
 2 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 0cd47fe0dbe5..ade9d3aa1ada 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -24,17 +24,46 @@
 
 /*
  * Inode locking rules:
+ * (Documentation improved by LockDoc)
  *
- * inode->i_lock protects:
- *   inode->i_state, inode->i_hash, __iget()
- * Inode LRU list locks protect:
- *   inode->i_sb->s_inode_lru, inode->i_lru
- * inode->i_sb->s_inode_list_lock protects:
- *   inode->i_sb->s_inodes, inode->i_sb_list
- * bdi->wb.list_lock protects:
- *   bdi->wb.b_{dirty,io,more_io,dirty_time}, inode->i_io_list
- * inode_hash_lock protects:
- *   inode_hashtable, inode->i_hash
+ * No locks needed for:
+ *   i_data.a_ops, i_data.nrexceptional, i_rdev, i_data.gfp_mask,
+ *   i_generation, i_security, i_nlink, __i_nlink, i_flctx,
+ *   i_size, i_atime, i_mtime, i_data.host, i_sb
+ *
+ * backing_dev_info.wb.list_lock protects:
+ *   dirtied_when, i_io_list
+ *
+ * inode.i_rwsem protects:
+ *   i_flags, i_uid, i_gid, i_version, i_ctime, i_size_seqcount
+ *
+ * inode.i_rwsem -> rcu protects:
+ *   i_default_acl
+ *
+ * block_device.bd_mutex protects:
+ *   i_blkbits
+ *
+ * cdev_lock protects:
+ *   i_cdev, i_devices
+ *
+ * inode.i_data.i_mmap_rwsem protects:
+ *   i_data.i_mmap, i_data.i_mmap
+ *
+ * hardirq -> inode.i_data.tree_lock protects:
+ *   i_data.page_tree, i_wb_list, i_data.nrpages
+ *
+ * hardirq -> super_block.s_inode_wblist_lock protects:
+ *   i_wb_list
+ *
+ * inode.i_lock protects:
+ *   i_pipe, i_fsnotify_mask, i_fsnotify_marks, i_blocks, i_opflags,
+ *   i_state, i_bytes
+ *
+ * super_block.s_inode_list_lock protects:
+ *   i_sb_list
+ *
+ * inode_hash_lock -> inode.i_lock protects:
+ *   i_hash
  *
  * Lock ordering:
  *
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 92966678539d..744e2a817ad3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -639,7 +639,7 @@ struct inode {
 	struct timespec64	i_atime;
 	struct timespec64	i_mtime;
 	struct timespec64	i_ctime;
-	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
+	spinlock_t		i_lock;
 	unsigned short          i_bytes;
 	u8			i_blkbits;
 	u8			i_write_hint;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-08 15:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 15:04 [PATCH 1/1] Updated locking documentation for struct inode Alexander Lochmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).