aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/bmap.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-03-26 13:51:39 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-12 20:53:49 -0400
commitbcb48891b05b4179edc86298d3dccb2ce90d5413 (patch)
treec7cd9e37ca46e4f7241be2faa5f5c6e7625d7520 /fs/nilfs2/bmap.c
parentc306af23e19d3c94c9229263c39fe487e915e774 (diff)
nilfs2: fix lockdep recursive locking warning on bmap
The bmap semaphore of DAT file can be held while a bmap of other files is locked. This has caused the following false detection of lockdep check: mount.nilfs2/4667 is trying to acquire lock: (&bmap->b_sem){..--}, at: [<d0c6c4b4>] nilfs_bmap_lookup_at_level+0x1a/0x74 [nilfs2] but task is already holding lock: (&bmap->b_sem){..--}, at: [<d0c6c4b4>] nilfs_bmap_lookup_at_level+0x1a/0x74 [nilfs2] This will fix the false detection by distinguishing semaphores of the DAT and other files. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/bmap.c')
-rw-r--r--fs/nilfs2/bmap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index 24638e059bf3..064279e33bbb 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -688,6 +688,8 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_gc = {
688 .bpop_translate = NULL, 688 .bpop_translate = NULL,
689}; 689};
690 690
691static struct lock_class_key nilfs_bmap_dat_lock_key;
692
691/** 693/**
692 * nilfs_bmap_read - read a bmap from an inode 694 * nilfs_bmap_read - read a bmap from an inode
693 * @bmap: bmap 695 * @bmap: bmap
@@ -715,6 +717,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
715 bmap->b_pops = &nilfs_bmap_ptr_ops_p; 717 bmap->b_pops = &nilfs_bmap_ptr_ops_p;
716 bmap->b_last_allocated_key = 0; /* XXX: use macro */ 718 bmap->b_last_allocated_key = 0; /* XXX: use macro */
717 bmap->b_last_allocated_ptr = NILFS_BMAP_NEW_PTR_INIT; 719 bmap->b_last_allocated_ptr = NILFS_BMAP_NEW_PTR_INIT;
720 lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
718 break; 721 break;
719 case NILFS_CPFILE_INO: 722 case NILFS_CPFILE_INO:
720 case NILFS_SUFILE_INO: 723 case NILFS_SUFILE_INO:
@@ -772,6 +775,7 @@ void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
772{ 775{
773 memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union)); 776 memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union));
774 init_rwsem(&gcbmap->b_sem); 777 init_rwsem(&gcbmap->b_sem);
778 lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
775 gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode; 779 gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode;
776} 780}
777 781
@@ -779,5 +783,6 @@ void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
779{ 783{
780 memcpy(bmap, gcbmap, sizeof(union nilfs_bmap_union)); 784 memcpy(bmap, gcbmap, sizeof(union nilfs_bmap_union));
781 init_rwsem(&bmap->b_sem); 785 init_rwsem(&bmap->b_sem);
786 lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
782 bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode; 787 bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;
783} 788}