Skip to contentSkip to conversation

ovl: lockdep annotate of nested OVL_I(inode)->lock

PATCH New Amir Goldstein 1 participant 1 message Oct 27, 2017 Overlay filesystem

lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: lockdep annotate of nested OVL_I(inode)->lock

This fixes a lockdep splat when mounting a nested overlayfs.

Fixes a015dafcaf5b ("ovl: use ovl_inode mutex to synchronize...")
Cc <[email protected]> # v4.13

---

Miklos,

Another v4.13 fix for a very minor false positive lockdep regression. Not critical, so if there is no rc8 this cycle can wait for next cycle.

Amir.

 fs/overlayfs/inode.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/overlayfs/inode.c +4 -0
index a623c0b60583..ab2e24f43087 100644
@@ -14,6 +14,7 @@
 #include <linux/posix_acl.h>
 #include <linux/ratelimit.h>
 #include "overlayfs.h"
+#include "ovl_entry.h"
 
 int ovl_setattr(struct dentry *dentry, struct iattr *attr)
 {
@@ -411,6 +412,7 @@ static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
 #ifdef CONFIG_LOCKDEP
 	static struct lock_class_key ovl_i_mutex_key[OVL_MAX_NESTING];
 	static struct lock_class_key ovl_i_mutex_dir_key[OVL_MAX_NESTING];
+	static struct lock_class_key ovl_i_lock_key[OVL_MAX_NESTING];
 
 	int depth = inode->i_sb->s_stack_depth - 1;
 
@@ -421,6 +423,8 @@ static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
 		lockdep_set_class(&inode->i_rwsem, &ovl_i_mutex_dir_key[depth]);
 	else
 		lockdep_set_class(&inode->i_rwsem, &ovl_i_mutex_key[depth]);
+
+	lockdep_set_class(&OVL_I(inode)->lock, &ovl_i_lock_key[depth]);
 #endif
 }
 
Signature · 1 line
2.7.4