]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Btrfs: Fix misuse of chunk mutex
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 3 Sep 2014 13:35:41 +0000 (21:35 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:38:42 +0000 (13:38 -0700)
commit2196d6e8a71fc901e31c1d81581fc6cc6c64913e
tree41d1aaaafcd9e6792a3a368407f4416c6d4b7ac8
parent15484377f597ca98ee84de87caa13667ea68bb14
Btrfs: Fix misuse of chunk mutex

There were several problems about chunk mutex usage:
- Lock chunk mutex when updating metadata. It would cause the nested
  deadlock because updating metadata might need allocate new chunks
  that need acquire chunk mutex. We remove chunk mutex at this case,
  because b-tree lock and other lock mechanism can help us.
- ABBA deadlock occured between device_list_mutex and chunk_mutex.
  When we update device status, we must acquire device_list_mutex at the
  beginning, and then we might get chunk_mutex during the device status
  update because we need allocate new chunks for metadata COW. But at
  most place, we acquire chunk_mutex at first and then acquire device list
  mutex. We need change the lock order.
- Some place we needn't acquire chunk_mutex. For example we needn't get
  chunk_mutex when we free a empty seed fs_devices structure.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/dev-replace.c
fs/btrfs/extent-tree.c
fs/btrfs/volumes.c