mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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>
This commit is contained in:
parent
53fc622b9e
commit
5fa0613ea5
@ -58,7 +58,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,
|
|||||||
return ERR_PTR(-ESTALE);
|
return ERR_PTR(-ESTALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = ocfs2_iget(OCFS2_SB(sb), handle->ih_blkno, 0);
|
inode = ocfs2_iget(OCFS2_SB(sb), handle->ih_blkno, 0, 0);
|
||||||
|
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return (void *)inode;
|
return (void *)inode;
|
||||||
@ -109,7 +109,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
|
|||||||
goto bail_unlock;
|
goto bail_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0);
|
inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
mlog(ML_ERROR, "Unable to create inode %llu\n",
|
mlog(ML_ERROR, "Unable to create inode %llu\n",
|
||||||
(unsigned long long)blkno);
|
(unsigned long long)blkno);
|
||||||
|
@ -57,8 +57,11 @@ struct ocfs2_find_inode_args
|
|||||||
u64 fi_blkno;
|
u64 fi_blkno;
|
||||||
unsigned long fi_ino;
|
unsigned long fi_ino;
|
||||||
unsigned int fi_flags;
|
unsigned int fi_flags;
|
||||||
|
unsigned int fi_sysfile_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct lock_class_key ocfs2_sysfile_lock_key[NUM_SYSTEM_INODES];
|
||||||
|
|
||||||
static int ocfs2_read_locked_inode(struct inode *inode,
|
static int ocfs2_read_locked_inode(struct inode *inode,
|
||||||
struct ocfs2_find_inode_args *args);
|
struct ocfs2_find_inode_args *args);
|
||||||
static int ocfs2_init_locked_inode(struct inode *inode, void *opaque);
|
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)
|
|||||||
oi->ip_attr |= OCFS2_DIRSYNC_FL;
|
oi->ip_attr |= OCFS2_DIRSYNC_FL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags)
|
struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
|
||||||
|
int sysfile_type)
|
||||||
{
|
{
|
||||||
struct inode *inode = NULL;
|
struct inode *inode = NULL;
|
||||||
struct super_block *sb = osb->sb;
|
struct super_block *sb = osb->sb;
|
||||||
@ -126,6 +130,7 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags)
|
|||||||
args.fi_blkno = blkno;
|
args.fi_blkno = blkno;
|
||||||
args.fi_flags = flags;
|
args.fi_flags = flags;
|
||||||
args.fi_ino = ino_from_blkno(sb, blkno);
|
args.fi_ino = ino_from_blkno(sb, blkno);
|
||||||
|
args.fi_sysfile_type = sysfile_type;
|
||||||
|
|
||||||
inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor,
|
inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor,
|
||||||
ocfs2_init_locked_inode, &args);
|
ocfs2_init_locked_inode, &args);
|
||||||
@ -200,6 +205,9 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque)
|
|||||||
|
|
||||||
inode->i_ino = args->fi_ino;
|
inode->i_ino = args->fi_ino;
|
||||||
OCFS2_I(inode)->ip_blkno = args->fi_blkno;
|
OCFS2_I(inode)->ip_blkno = args->fi_blkno;
|
||||||
|
if (args->fi_sysfile_type != 0)
|
||||||
|
lockdep_set_class(&inode->i_mutex,
|
||||||
|
&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
|
||||||
|
|
||||||
mlog_exit(0);
|
mlog_exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -120,9 +120,10 @@ void ocfs2_delete_inode(struct inode *inode);
|
|||||||
void ocfs2_drop_inode(struct inode *inode);
|
void ocfs2_drop_inode(struct inode *inode);
|
||||||
|
|
||||||
/* Flags for ocfs2_iget() */
|
/* Flags for ocfs2_iget() */
|
||||||
#define OCFS2_FI_FLAG_SYSFILE 0x4
|
#define OCFS2_FI_FLAG_SYSFILE 0x1
|
||||||
#define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x8
|
#define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x2
|
||||||
struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, int flags);
|
struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, unsigned flags,
|
||||||
|
int sysfile_type);
|
||||||
int ocfs2_inode_init_private(struct inode *inode);
|
int ocfs2_inode_init_private(struct inode *inode);
|
||||||
int ocfs2_inode_revalidate(struct dentry *dentry);
|
int ocfs2_inode_revalidate(struct dentry *dentry);
|
||||||
int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
|
int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
|
||||||
|
@ -1244,7 +1244,7 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len,
|
|||||||
|
|
||||||
/* Skip bad inodes so that recovery can continue */
|
/* Skip bad inodes so that recovery can continue */
|
||||||
iter = ocfs2_iget(p->osb, ino,
|
iter = ocfs2_iget(p->osb, ino,
|
||||||
OCFS2_FI_FLAG_ORPHAN_RECOVERY);
|
OCFS2_FI_FLAG_ORPHAN_RECOVERY, 0);
|
||||||
if (IS_ERR(iter))
|
if (IS_ERR(iter))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
if (status < 0)
|
if (status < 0)
|
||||||
goto bail_add;
|
goto bail_add;
|
||||||
|
|
||||||
inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0);
|
inode = ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
ret = ERR_PTR(-EACCES);
|
ret = ERR_PTR(-EACCES);
|
||||||
goto bail_unlock;
|
goto bail_unlock;
|
||||||
|
@ -220,7 +220,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
|
|||||||
|
|
||||||
mlog_entry_void();
|
mlog_entry_void();
|
||||||
|
|
||||||
new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE);
|
new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
|
||||||
if (IS_ERR(new)) {
|
if (IS_ERR(new)) {
|
||||||
status = PTR_ERR(new);
|
status = PTR_ERR(new);
|
||||||
mlog_errno(status);
|
mlog_errno(status);
|
||||||
@ -228,7 +228,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
|
|||||||
}
|
}
|
||||||
osb->root_inode = new;
|
osb->root_inode = new;
|
||||||
|
|
||||||
new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE);
|
new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
|
||||||
if (IS_ERR(new)) {
|
if (IS_ERR(new)) {
|
||||||
status = PTR_ERR(new);
|
status = PTR_ERR(new);
|
||||||
mlog_errno(status);
|
mlog_errno(status);
|
||||||
|
@ -112,7 +112,7 @@ static struct inode * _ocfs2_get_system_file_inode(struct ocfs2_super *osb,
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = ocfs2_iget(osb, blkno, OCFS2_FI_FLAG_SYSFILE);
|
inode = ocfs2_iget(osb, blkno, OCFS2_FI_FLAG_SYSFILE, type);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
mlog_errno(PTR_ERR(inode));
|
mlog_errno(PTR_ERR(inode));
|
||||||
inode = NULL;
|
inode = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user