diff options
author | Peng Tao <bergwolf@gmail.com> | 2012-01-12 10:18:47 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-12 16:39:04 -0500 |
commit | 93a3844ee0f843b05a1df4b52e1a19ff26b98d24 (patch) | |
tree | efd2ca7a8a711e779a04c47af6166abd8f844073 /fs/nfs/blocklayout | |
parent | 57582b372f63d0f655b1a35b0d306d73d1a46775 (diff) |
pnfsblock: don't spinlock when freeing block_dev
bl_free_block_dev() may sleep. We can not call it with spinlock held.
Besides, there is no need to take bm_lock as we are last user freeing bm_devlist.
Cc: <stable@vger.kernel.org> #3.1+
Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/blocklayout')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 06fe08021182..6d39e9ab1e64 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -780,16 +780,13 @@ bl_cleanup_layoutcommit(struct nfs4_layoutcommit_data *lcdata) | |||
780 | static void free_blk_mountid(struct block_mount_id *mid) | 780 | static void free_blk_mountid(struct block_mount_id *mid) |
781 | { | 781 | { |
782 | if (mid) { | 782 | if (mid) { |
783 | struct pnfs_block_dev *dev; | 783 | struct pnfs_block_dev *dev, *tmp; |
784 | spin_lock(&mid->bm_lock); | 784 | |
785 | while (!list_empty(&mid->bm_devlist)) { | 785 | /* No need to take bm_lock as we are last user freeing bm_devlist */ |
786 | dev = list_first_entry(&mid->bm_devlist, | 786 | list_for_each_entry_safe(dev, tmp, &mid->bm_devlist, bm_node) { |
787 | struct pnfs_block_dev, | ||
788 | bm_node); | ||
789 | list_del(&dev->bm_node); | 787 | list_del(&dev->bm_node); |
790 | bl_free_block_dev(dev); | 788 | bl_free_block_dev(dev); |
791 | } | 789 | } |
792 | spin_unlock(&mid->bm_lock); | ||
793 | kfree(mid); | 790 | kfree(mid); |
794 | } | 791 | } |
795 | } | 792 | } |