Skip to contentSkip to conversation

lockdep: annotate proc and other filesystems

RFC PATCH New Mimi Zohar 1 participant 1 message Dec 12, 2011

Subsystems (8)
lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

RFC PATCH 1/1 lockdep: annotate proc and other filesystems

Using lockdep_annotate_inode_mutex_key() to annotate proc and other filesystems, resolves the lockdep messages as described in
http://www.spinics.net/lists/linux-fsdevel/msg49879.html.

Commit "e096d0c lockdep: Add helper function for dir vs file i_mutex annotation" defined lockdep_annotate_inode_mutex_key(), a helper function, but only updated hugetlbfs to call this function.

This patch annotates proc and other filesystems, which call new_inode() directly.

---
 fs/debugfs/inode.c           |    1 +
 fs/devpts/inode.c            |    4 +++-
 fs/proc/base.c               |    4 ++++
 fs/proc/namespaces.c         |    1 +
 fs/proc/proc_sysctl.c        |    1 +
 fs/ramfs/inode.c             |    1 +
 mm/shmem.c                   |    1 +
 security/inode.c             |    1 +
 security/selinux/selinuxfs.c |    1 +
 9 files changed, 14 insertions(+), 1 deletions(-)
fs/debugfs/inode.c +1 -0
index f3a257d..707c14a 100644
@@ -63,6 +63,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
 			inc_nlink(inode);
 			break;
 		}
+		lockdep_annotate_inode_mutex_key(inode);
 	}
 	return inode; 
 }
fs/devpts/inode.c +3 -1
index d5d5297..11a0cc1 100644
@@ -310,8 +310,10 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
 	set_nlink(inode, 2);
 
 	s->s_root = d_alloc_root(inode);
-	if (s->s_root)
+	if (s->s_root) {
+		lockdep_annotate_inode_mutex_key(inode);
 		return 0;
+	}
 
 	printk(KERN_ERR "devpts: get root dentry failed\n");
 	iput(inode);
fs/proc/base.c +4 -0
index 851ba3d..44d60ce 100644
@@ -2259,6 +2259,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir,
 	/* Close the race of the process dying before we return the dentry */
 	if (pid_revalidate(dentry, NULL))
 		error = NULL;
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return error;
 }
@@ -2652,6 +2653,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
 	ei->op = p->op;
 	d_add(dentry, inode);
 	error = NULL;
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return error;
 out_iput:
@@ -2990,6 +2992,7 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
 	/* Close the race of the process dying before we return the dentry */
 	if (pid_revalidate(dentry, NULL))
 		error = NULL;
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return error;
 }
@@ -3242,6 +3245,7 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
 	/* Close the race of the process dying before we return the dentry */
 	if (pid_revalidate(dentry, NULL))
 		error = NULL;
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return error;
 }
fs/proc/namespaces.c +1 -0
index be177f7..e366ab9 100644
@@ -59,6 +59,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir,
 	/* Close the race of the process dying before we return the dentry */
 	if (pid_revalidate(dentry, NULL))
 		error = NULL;
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return error;
 out_iput:
fs/proc/proc_sysctl.c +1 -0
index a6b6217..096572f 100644
@@ -53,6 +53,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
 		inode->i_op = &proc_sys_dir_operations;
 		inode->i_fop = &proc_sys_dir_file_operations;
 	}
+	lockdep_annotate_inode_mutex_key(inode);
 out:
 	return inode;
 }
fs/ramfs/inode.c +1 -0
index 462ceb3..7fb2f56 100644
@@ -83,6 +83,7 @@ struct inode *ramfs_get_inode(struct super_block *sb,
 			inode->i_op = &page_symlink_inode_operations;
 			break;
 		}
+		lockdep_annotate_inode_mutex_key(inode);
 	}
 	return inode;
 }
mm/shmem.c +1 -0
index d672250..addd5a8 100644
@@ -1144,6 +1144,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 			mpol_shared_policy_init(&info->policy, NULL);
 			break;
 		}
+		lockdep_annotate_inode_mutex_key(inode);
 	} else
 		shmem_free_inode(sb);
 	return inode;
security/inode.c +1 -0
index c4df2fb..fd61a3d 100644
@@ -79,6 +79,7 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
 			inc_nlink(inode);
 			break;
 		}
+		lockdep_annotate_inode_mutex_key(inode);
 	}
 	return inode;
 }
security/selinux/selinuxfs.c +1 -0
index 48a7d00..7997840 100644
@@ -1030,6 +1030,7 @@ static struct inode *sel_make_inode(struct super_block *sb, int mode)
 	if (ret) {
 		ret->i_mode = mode;
 		ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
+		lockdep_annotate_inode_mutex_key(ret);
 	}
 	return ret;
 }
Signature · 1 line
1.7.6.4