diff options
author | Jan Kara <jack@suse.cz> | 2008-01-10 18:11:45 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2008-01-25 18:05:44 -0500 |
commit | 5fa0613ea58a80f69852b242337121bd39dc798e (patch) | |
tree | 21170694624428a8903efc6cba843fd10de93c64 | |
parent | 53fc622b9e829c8e632e45ef8c14f054388759c1 (diff) |
ocfs2: Silence false lockdep warnings
Create separate lockdep lock classes for system file's i_mutexes. They are
used to guard allocations and similar things and thus rank differently
than i_mutex of a regular file or directory.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/ocfs2/export.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 7 | ||||
-rw-r--r-- | fs/ocfs2/journal.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/sysfile.c | 2 |
7 files changed, 20 insertions, 11 deletions
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 1f9e353cac45..67527cebf214 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
@@ -58,7 +58,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, | |||
58 | return ERR_PTR(-ESTALE); | 58 | return ERR_PTR(-ESTALE); |
59 | } | 59 | } |
60 | 60 | ||
61 | inode = ocfs2_iget(OCFS2_SB(sb), handle->ih_blkno, 0); | 61 | inode = ocfs2_iget(OCFS2_SB(sb), handle->ih_blkno, 0, 0); |
62 | 62 | ||
63 | if (IS_ERR(inode)) | 63 | if (IS_ERR(inode)) |
64 | return (void *)inode; | 64 | return (void *)inode; |
@@ -109,7 +109,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) | |||
109 | goto bail_unlock; | 109 | goto bail_unlock; |
110 | } | 110 | } |
111 | 111 | ||
112 | inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0); | 112 | inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0); |
113 | if (IS_ERR(inode)) { | 113 | if (IS_ERR(inode)) { |
114 | mlog(ML_ERROR, "Unable to create inode %llu\n", | 114 | mlog(ML_ERROR, "Unable to create inode %llu\n", |
115 | (unsigned long long)blkno); | 115 | (unsigned long long)blkno); |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 00cd5b7f3e52..5e19c119183d 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -57,8 +57,11 @@ struct ocfs2_find_inode_args | |||
57 | u64 fi_blkno; | 57 | u64 fi_blkno; |
58 | unsigned long fi_ino; | 58 | unsigned long fi_ino; |
59 | unsigned int fi_flags; | 59 | unsigned int fi_flags; |
60 | unsigned int fi_sysfile_type; | ||
60 | }; | 61 | }; |
61 | 62 | ||
63 | static struct lock_class_key ocfs2_sysfile_lock_key[NUM_SYSTEM_INODES]; | ||
64 | |||
62 | static int ocfs2_read_locked_inode(struct inode *inode, | 65 | static int ocfs2_read_locked_inode(struct inode *inode, |
63 | struct ocfs2_find_inode_args *args); | 66 | struct ocfs2_find_inode_args *args); |
64 | static int ocfs2_init_locked_inode(struct inode *inode, void *opaque); | 67 | static int ocfs2_init_locked_inode(struct inode *inode, void *opaque); |
@@ -106,7 +109,8 @@ void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi) | |||
106 | oi->ip_attr |= OCFS2_DIRSYNC_FL; | 109 | oi->ip_attr |= OCFS2_DIRSYNC_FL; |
107 | } | 110 | } |
108 | 111 | ||
109 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) | 112 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, |
113 | int sysfile_type) | ||
110 | { | 114 | { |
111 | struct inode *inode = NULL; | 115 | struct inode *inode = NULL; |
112 | struct super_block *sb = osb->sb; | 116 | struct super_block *sb = osb->sb; |
@@ -126,6 +130,7 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) | |||
126 | args.fi_blkno = blkno; | 130 | args.fi_blkno = blkno; |
127 | args.fi_flags = flags; | 131 | args.fi_flags = flags; |
128 | args.fi_ino = ino_from_blkno(sb, blkno); | 132 | args.fi_ino = ino_from_blkno(sb, blkno); |
133 | args.fi_sysfile_type = sysfile_type; | ||
129 | 134 | ||
130 | inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor, | 135 | inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor, |
131 | ocfs2_init_locked_inode, &args); | 136 | ocfs2_init_locked_inode, &args); |
@@ -200,6 +205,9 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque) | |||
200 | 205 | ||
201 | inode->i_ino = args->fi_ino; | 206 | inode->i_ino = args->fi_ino; |
202 | OCFS2_I(inode)->ip_blkno = args->fi_blkno; | 207 | OCFS2_I(inode)->ip_blkno = args->fi_blkno; |
208 | if (args->fi_sysfile_type != 0) | ||
209 | lockdep_set_class(&inode->i_mutex, | ||
210 | &ocfs2_sysfile_lock_key[args->fi_sysfile_type]); | ||
203 | 211 | ||
204 | mlog_exit(0); | 212 | mlog_exit(0); |
205 | return 0; | 213 | return 0; |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index a61c044eb7da..390a85596aa0 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -120,9 +120,10 @@ void ocfs2_delete_inode(struct inode *inode); | |||
120 | void ocfs2_drop_inode(struct inode *inode); | 120 | void ocfs2_drop_inode(struct inode *inode); |
121 | 121 | ||
122 | /* Flags for ocfs2_iget() */ | 122 | /* Flags for ocfs2_iget() */ |
123 | #define OCFS2_FI_FLAG_SYSFILE 0x4 | 123 | #define OCFS2_FI_FLAG_SYSFILE 0x1 |
124 | #define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x8 | 124 | #define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x2 |
125 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, int flags); | 125 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, unsigned flags, |
126 | int sysfile_type); | ||
126 | int ocfs2_inode_init_private(struct inode *inode); | 127 | int ocfs2_inode_init_private(struct inode *inode); |
127 | int ocfs2_inode_revalidate(struct dentry *dentry); | 128 | int ocfs2_inode_revalidate(struct dentry *dentry); |
128 | int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | 129 | int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 8b9ce2a729ab..f31c7e8c19c3 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1244,7 +1244,7 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len, | |||
1244 | 1244 | ||
1245 | /* Skip bad inodes so that recovery can continue */ | 1245 | /* Skip bad inodes so that recovery can continue */ |
1246 | iter = ocfs2_iget(p->osb, ino, | 1246 | iter = ocfs2_iget(p->osb, ino, |
1247 | OCFS2_FI_FLAG_ORPHAN_RECOVERY); | 1247 | OCFS2_FI_FLAG_ORPHAN_RECOVERY, 0); |
1248 | if (IS_ERR(iter)) | 1248 | if (IS_ERR(iter)) |
1249 | return 0; | 1249 | return 0; |
1250 | 1250 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 74018caf8053..ae9ad9587516 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -128,7 +128,7 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
128 | if (status < 0) | 128 | if (status < 0) |
129 | goto bail_add; | 129 | goto bail_add; |
130 | 130 | ||
131 | inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0); | 131 | inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0); |
132 | if (IS_ERR(inode)) { | 132 | if (IS_ERR(inode)) { |
133 | ret = ERR_PTR(-EACCES); | 133 | ret = ERR_PTR(-EACCES); |
134 | goto bail_unlock; | 134 | goto bail_unlock; |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 4a091f586646..01fe40ee5ea9 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -220,7 +220,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) | |||
220 | 220 | ||
221 | mlog_entry_void(); | 221 | mlog_entry_void(); |
222 | 222 | ||
223 | new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE); | 223 | new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0); |
224 | if (IS_ERR(new)) { | 224 | if (IS_ERR(new)) { |
225 | status = PTR_ERR(new); | 225 | status = PTR_ERR(new); |
226 | mlog_errno(status); | 226 | mlog_errno(status); |
@@ -228,7 +228,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) | |||
228 | } | 228 | } |
229 | osb->root_inode = new; | 229 | osb->root_inode = new; |
230 | 230 | ||
231 | new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE); | 231 | new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0); |
232 | if (IS_ERR(new)) { | 232 | if (IS_ERR(new)) { |
233 | status = PTR_ERR(new); | 233 | status = PTR_ERR(new); |
234 | mlog_errno(status); | 234 | mlog_errno(status); |
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c index fd2e846e3e6f..ab713ebdd546 100644 --- a/fs/ocfs2/sysfile.c +++ b/fs/ocfs2/sysfile.c | |||
@@ -112,7 +112,7 @@ static struct inode * _ocfs2_get_system_file_inode(struct ocfs2_super *osb, | |||
112 | goto bail; | 112 | goto bail; |
113 | } | 113 | } |
114 | 114 | ||
115 | inode = ocfs2_iget(osb, blkno, OCFS2_FI_FLAG_SYSFILE); | 115 | inode = ocfs2_iget(osb, blkno, OCFS2_FI_FLAG_SYSFILE, type); |
116 | if (IS_ERR(inode)) { | 116 | if (IS_ERR(inode)) { |
117 | mlog_errno(PTR_ERR(inode)); | 117 | mlog_errno(PTR_ERR(inode)); |
118 | inode = NULL; | 118 | inode = NULL; |