Project

General

Profile

Bug #4105

removing a mirrored log device results in a leaked object

Added by Christopher Siden about 6 years ago. Updated about 6 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Bug report by George Wilson:

I noticed that the current logic for vdev_remove() does not deal with removing
top-levels that are interior vdevs (i.e. mirror). The current code looks like
this:

void
vdev_remove(vdev_t *vd, uint64_t txg)
{
        spa_t *spa = vd->vdev_spa;
        objset_t *mos = spa->spa_meta_objset;
        dmu_tx_t *tx;

        tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg);

        if (vd->vdev_dtl_smo.smo_object) {
                ASSERT0(vd->vdev_dtl_smo.smo_alloc);
                (void) dmu_object_free(mos, vd->vdev_dtl_smo.smo_object, tx);
                vd->vdev_dtl_smo.smo_object = 0;
        }
<snip>
}

The problem is that this is called with a top-level vdev and top-level vdevs
don't have DTL space map objects associated with them. So when a mirrored log
device is removed the logic is not invoked and the DTL space map object is
leaked:

# zpool status data
  pool: data
 state: ONLINE
  scan: resilvered 0 in 0h0m with 0 errors on Mon Apr 22 17:27:18 2013
config:

        NAME        STATE     READ WRITE CKSUM
        data        ONLINE       0     0     0
          c1t1d0    ONLINE       0     0     0
        logs
          mirror-1  ONLINE       0     0     0
            c1t3d0  ONLINE       0     0     0
            c1t2d0  ONLINE       0     0     0

# zdb -l /dev/dsk/c1t2d0s0

--------------------------------------------
LABEL 0
--------------------------------------------
    version: 5000
    name: 'data'
    state: 0
    txg: 100
    pool_guid: 4428115583932848145
    hostname: 'gwilson-test.dcenter'
    top_guid: 4159801240690351606
    guid: 10657665460674714622
    vdev_children: 2
    vdev_tree:
        type: 'mirror'
        id: 1
        guid: 4159801240690351606
        whole_disk: 0
        metaslab_array: 33
        metaslab_shift: 26
        ashift: 9
        asize: 8576565248
        is_log: 1
        create_txg: 4
        children[0]:
            type: 'disk'
            id: 0
            guid: 9691316810508771455
            path: '/dev/dsk/c1t3d0s0'
            devid: 'id1,sd@n6000c29897deddc60e88b8cea3ff32e1/a'
            phys_path: '/pci@0,0/pci15ad,1976@10/sd@3,0:a'
            whole_disk: 1
            DTL: 47
            create_txg: 4
            offline: 1
        children[1]:
            type: 'disk'
            id: 1
            guid: 10657665460674714622
            path: '/dev/dsk/c1t2d0s0'
            devid: 'id1,sd@n6000c293d4b318002020c9c916bbba6e/a'
            phys_path: '/pci@0,0/pci15ad,1976@10/sd@2,0:a'
            whole_disk: 1
            DTL: 53
            create_txg: 4
    features_for_read:

# zdb -ddddd data 53
Dataset mos [META], ID 0, cr_txg 4, 318K, 54 objects, rootbp
DVA[0]=<0:127e5000:800> DVA[1]=<0:6003f200:800> DVA[2]=<0:c0049a00:800> [L0 DMU
objset] fletcher4 uncompressed LE contiguous unique triple size=800L/800P
birth=102L/102P fill=54
cksum=6c8e3c49d:c08ff8fe7ae:ab6c106eb7d46:661c50e051ad6d8

    Object  lvl   iblk   dblk  dsize  lsize   %full  type
        53    1    16K     4K      0     4K    0.00  SPA space map
                                         24   bonus  SPA space map header
        dnode flags: USED_BYTES 
        dnode maxblkid: 0
Indirect blocks:

# zpool remove data mirror-1
# zdb -ddddd data 53
Dataset mos [META], ID 0, cr_txg 4, 110K, 52 objects, rootbp
DVA[0]=<0:1b553800:200> DVA[1]=<0:601bf200:200> DVA[2]=<0:c0104200:200> [L0 DMU
objset] fletcher4 lzjb LE contiguous unique triple size=800L/200P
birth=115L/115P fill=52
cksum=121e3c687d:67ff038412d:1361b77c1f8a9:27feb5d1d704fa

    Object  lvl   iblk   dblk  dsize  lsize   %full  type
        53    1    16K     4K      0     4K    0.00  SPA space map
                                         24   bonus  SPA space map header
        dnode flags: USED_BYTES 
        dnode maxblkid: 0
Indirect blocks:

The same thing is true for object 47 (the other DTL space map object).

History

#1

Updated by Christopher Siden about 6 years ago

commit 0713e232b7712cd27d99e1e935ebb8d5de61c57d
Author: George Wilson <george.wilson@delphix.com>
Date:   Tue Oct 1 14:25:53 2013

    4101 metaslab_debug should allow for fine-grained control
    4102 space_maps should store more information about themselves
    4103 space map object blocksize should be increased
    4104 ::spa_space no longer works
    4105 removing a mirrored log device results in a leaked object
    4106 asynchronously load metaslab
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Adam Leventhal <ahl@delphix.com>
    Reviewed by: Sebastien Roy <seb@delphix.com>
    Approved by: Garrett D'Amore <garrett@damore.org>
#2

Updated by Christopher Siden about 6 years ago

  • Status changed from New to Closed
commit 0713e232b7712cd27d99e1e935ebb8d5de61c57d
Author: George Wilson <george.wilson@delphix.com>
Date:   Tue Oct 1 14:25:53 2013

    4101 metaslab_debug should allow for fine-grained control
    4102 space_maps should store more information about themselves
    4103 space map object blocksize should be increased
    4104 ::spa_space no longer works
    4105 removing a mirrored log device results in a leaked object
    4106 asynchronously load metaslab
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Adam Leventhal <ahl@delphix.com>
    Reviewed by: Sebastien Roy <seb@delphix.com>
    Approved by: Garrett D'Amore <garrett@damore.org>

Also available in: Atom PDF