lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190308150447.96311-1-alexander.lochmann@tu-dortmund.de>
Date:   Fri,  8 Mar 2019 16:04:47 +0100
From:   Alexander Lochmann <alexander.lochmann@...dortmund.de>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Alexander Lochmann <alexander.lochmann@...dortmund.de>,
        Horst Schirmeier <horst.schirmeier@...dortmund.de>
Subject: [PATCH 1/1] Updated locking documentation for struct inode

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@...dortmund.de>
Signed-off-by: Horst Schirmeier <horst.schirmeier@...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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ