* [RFC][PATCH] lockdep: annotate proc and other filesystems
@ 2011-12-12 12:33 Mimi Zohar
0 siblings, 0 replies; only message in thread
From: Mimi Zohar @ 2011-12-12 12:33 UTC (permalink / raw)
To: linux-security-module
Cc: Mimi Zohar, viro, Josh Boyer, Peter Zijlstra, linux-fsdevel,
Mimi Zohar
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.
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
---
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(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index f3a257d..707c14a 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -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;
}
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index d5d5297..11a0cc1 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -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);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 851ba3d..44d60ce 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -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;
}
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index be177f7..e366ab9 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -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:
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index a6b6217..096572f 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -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;
}
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 462ceb3..7fb2f56 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -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;
}
diff --git a/mm/shmem.c b/mm/shmem.c
index d672250..addd5a8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -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;
diff --git a/security/inode.c b/security/inode.c
index c4df2fb..fd61a3d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -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;
}
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 48a7d00..7997840 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -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;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-12-12 12:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 12:33 [RFC][PATCH] lockdep: annotate proc and other filesystems Mimi Zohar
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).