ndctl icon indicating copy to clipboard operation
ndctl copied to clipboard

[zero-labels] silently fails with active regions and namespaces without providing a helpful response

Open sscargal opened this issue 7 years ago • 1 comments

Config

OS: Fedora 28 Kernel: 4.17.9-200.fc28.x86_64 ndctl version: 61.5.g77fa917

Issue

Assuming a starting configuration with an active namespace and region:

# ndctl list -NRD --region 0
{
  "dimms":[
    {
      "dev":"nmem0",
      "id":"8089-a1-1811-00000058",
      "handle":1,
      "phys_id":32
    }
  ],
  "regions":[
    {
      "dev":"region0",
      "size":267361714176,
      "available_size":0,
      "type":"pmem",
      "numa_node":0,
      "iset_id":710683120631319073,
      "mappings":[
        {
          "dimm":"nmem0",
          "offset":268435456,
          "length":267361714176,
          "position":0
        }
      ],
      "persistence_domain":"memory_controller",
      "namespaces":[
        {
          "dev":"namespace0.0",
          "mode":"fsdax",
          "map":"dev",
          "size":263182090240,
          "uuid":"0da90773-da27-4083-8058-33b928563c90",
          "raw_uuid":"9ed56df2-c0a9-4e17-b82d-28f642f95a22",
          "sector_size":512,
          "blockdev":"pmem0",
          "numa_node":0
        }
      ]
    }
  ]
}

# ndctl read-labels nmem0 -j
{
  "dev":"nmem0",
  "index":[
    {
      "signature":"NAMESPACE_INDEX",
      "major":1,
      "minor":2,
      "labelsize":256,
      "seq":2,
      "nslot":510
    },
    {
      "signature":"NAMESPACE_INDEX",
      "major":1,
      "minor":2,
      "labelsize":256,
      "seq":1,
      "nslot":510
    }
  ],
  "label":[
    {
      "uuid":"9ed56df2-c0a9-4e17-b82d-28f642f95a22",
      "name":"",
      "slot":0,
      "position":0,
      "nlabel":1,
      "isetcookie":710683120631319073,
      "lbasize":512,
      "dpa":268435456,
      "rawsize":267361714176,
      "type_guid":"79d3f066-f3b4-7440-ac43-0d3318b78cdb",
      "abstraction_guid":"ba006426-9ffb-7746-bcb0-968f11d0d225"
    }
  ]
}
read 1 nmem

If we try to zero the labels, it silently fails and doesn't provide any information back to the user:

# ndctl zero-labels nmem0 -v
zeroed 0 nmem

Disabling the namespace doesn't help

# ndctl disable-namespace namespace0.0
disabled 1 namespace

#  ndctl zero-labels nmem0 -v
zeroed 0 nmem

Neither does destroying the namespace

# ndctl destroy-namespace namespace0.0
destroyed 1 namespace

#  ndctl zero-labels nmem0 -v
zeroed 0 nmem

However it does work when there's no namespace and the region is disabled

# ndctl disable-region region0
disabled 1 region

# ndctl zero-labels nmem0 -v
zeroed 1 nmem

Summary

The current message of 'zerod 0 nmem' tells the user that no action was taken by ndctl but doesn't provide any helpful information as to why the operation failed, or what the user can do to successfully zero the labels.

Suggested Improvements

  1. Update the man page to document that the namespace and region have to be destroyed or disabled prior to zeroing labels.

  2. Implement a '-f' option to automatically destroy the namespace & disable the region prior to zeroing the labels as other commands offer.

  3. The zero-labels should return a helpful message to the user indicating that there are active regions and namespaces and the '-f' flag should be used (if implemented). This is similar to what other commands report when encountering an error.

sscargal avatar Aug 17 '18 22:08 sscargal

ndctl zero-labels nmem0 -v nmem0: regions active, abort label write zeroed 0 nmem

hramrach avatar Mar 09 '22 20:03 hramrach