Project

General

Profile

Bug #3692

Panic on zfs receive of a recursive deduplicated stream

Added by Martin Matuška almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2013-04-04
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

After importing the changeset 13973:4972ab336f54 (3464 zfs synctask code needs restructuring) to FreeBSD (CURRENT) we have received user reports on kernel panics while receiving recursive deduplicated streams. Andriy Gapon's () investigation revealed that the call in dmu_send.c from restore_byte_byref() to dmu_objset_from_ds() happens without a dataset lock held.

https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/fs/zfs/dmu_send.c#L1264

This originates in add_ds_to_guidmap(), where the dataset is released after placing a long hold on it. This does not correspond to the in-code documentation in dsl_pool.c "DSL Pool Configuration Lock" regarding the use of long hold on datasets.

https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/fs/zfs/dmu_send.c#L1646

The panic is easy to reproduce, simply receive a recursive deduplicated stream (zfs send -R -D | zfs receive -d).

One of the possible solutions might by to release the dataset hold in free_guid_map_onexit() instead of add_ds_to_guidmap() , see attached patch.


Files

dmu_send.c.patch (702 Bytes) dmu_send.c.patch Martin Matuška, 2013-04-04 08:49 AM
dmu_send.c.2.patch (1.15 KB) dmu_send.c.2.patch Martin Matuška, 2013-04-06 10:44 AM

History

#1

Updated by Matthew Ahrens almost 7 years ago

  • Status changed from New to In Progress
  • Assignee set to Matthew Ahrens
#2

Updated by Martin Matuška almost 7 years ago

Updating patch with correct hold tag.

#3

Updated by Christopher Siden almost 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100
commit de8d9cf
Author: Matthew Ahrens <mahrens@delphix.com>
Date:   Wed Apr 10 14:54:56 2013

    3645 dmu_send_impl: possibilty of pool hold leak
    3692 Panic on zfs receive of a recursive deduplicated stream
    Reviewed by: Adam Leventhal <ahl@delphix.com>
    Reviewed by: Christopher Siden <christopher.siden@delphix.com>
    Reviewed by: Dan McDonald <danmcd@nexenta.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF