Skip to content

Commit

Permalink
pnfsblock: don't spinlock when freeing block_dev
Browse files Browse the repository at this point in the history
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> raspberrypi#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>
  • Loading branch information
bergwolf authored and Trond Myklebust committed Jan 12, 2012
1 parent 57582b3 commit 93a3844
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fs/nfs/blocklayout/blocklayout.c
Expand Up @@ -780,16 +780,13 @@ bl_cleanup_layoutcommit(struct nfs4_layoutcommit_data *lcdata)
static void free_blk_mountid(struct block_mount_id *mid)
{
if (mid) {
struct pnfs_block_dev *dev;
spin_lock(&mid->bm_lock);
while (!list_empty(&mid->bm_devlist)) {
dev = list_first_entry(&mid->bm_devlist,
struct pnfs_block_dev,
bm_node);
struct pnfs_block_dev *dev, *tmp;

/* No need to take bm_lock as we are last user freeing bm_devlist */
list_for_each_entry_safe(dev, tmp, &mid->bm_devlist, bm_node) {
list_del(&dev->bm_node);
bl_free_block_dev(dev);
}
spin_unlock(&mid->bm_lock);
kfree(mid);
}
}
Expand Down

0 comments on commit 93a3844

Please sign in to comment.