linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Btrfs device and pool management (wip)
@ 2015-11-30  7:59 Anand Jain
  2015-11-30 12:43 ` Qu Wenruo
  2015-11-30 14:51 ` Austin S Hemmelgarn
  0 siblings, 2 replies; 15+ messages in thread
From: Anand Jain @ 2015-11-30  7:59 UTC (permalink / raw)
  To: linux-btrfs

(fixed alignment)


------------
  Data center systems are generally aligned with the RAS (Reliability,
Availability and Serviceability) attributes. When it comes to Storage,
RAS applies even more because its matter of trust. In this context, one
of the primary area that a typical volume manager should be well tested
is, how well RAS attributes are maintained in the context of device
failure, and its further reporting.

  But, identifying a failed device is not a straight forward code. If
you look at some statistics performed on failed and returned disks,
most of the disks ends up being classified as NTF (No Trouble Found).
That is, host failed-and-replaced a disk even before it has actually
failed. This is not good for a cost effective setup who would want to
stretch the life of an intermittently failing device to its maximum
tenure and would want to replace only when it has confirmed dead.

  Also on the other hand, some of the data center admins would like to
mitigate the risk (of low performance at peak of their business
productions) of a potential failure, and prefer to pro-actively replace
the disk at their low business/workload hours, or they may choose to
replace a device even for read errors (mainly due to performance
reasons).

  In short a large variant of real MTF (Mean Time to Failure) for the
devices across the industries/users.


Consideration:

  - Have user-tunable to support different context of usages, which
should be applied on top of a set of disk IO errors, and its out come
will be to know if the disk can be failed.

  - Distinguish real disk failure (failed state) VS IO errors due to
intermittent transport errors (offline state). (I am not sure how to do
that yet, basically in some means, block layer could help?, RFC ?).

  - A sysfs offline interface, so as to udev update the kernel, when
disk is pulled out.

  - Because even to fail a device it depends on the user requirements,
btrfs IO completion threads instead of directly reacting on an IO
error, it will continue to just report the IO error into device error
statistics, and a spooler up on errors will apply user/system
criticalness as provided by the user on the top, which will decide if
the device has to be marked as failed OR if it can continue to be in
online.

  - A FS load pattern (mostly outside of btrfs-kernel or with in btrfs-
kernel) may pick the right time to replace the failed device, or to run
other FS maintenance activities (balance, scrub) automatically.

  - Sysfs will help user land scripts which may want to bring device to
offline or failed.



Device State flow:

   A device in the btrfs kernel can be in any one of following state:

   Online
      A normal healthy device

   Missing
      Device wasn't found that the time of mount OR device scan.

   Offline (disappeared)
      Device was present at some point in time after the FS was mounted,
      however offlined by user or block layer or hot unplug or device
      experienced transport error. Basically due to any error other than
      media error.
      The device in offline state are not candidate for the replace.
      Since still there is a hope that device may be restored to online
      at some point in time, by user or transport-layer error recovery.
      For device pulled out, there will be udev script which will call
      offline through sysfs. In the long run, we would also need to know
      the block layer to distinguish from the transient write errors
      like writes failing  due to transport error, vs write errors which
      are confirmed as target-device/device-media failure.

   Failed
      Device has confirmed a write/flush failure for at least a block.
      (In general the disk/storage FW will try to relocate the bad block
      on write, it happens automatically and transparent even to the
      block layer. Further there might have been few retry from the block
      layer. And here btrfs assumes that such an attempt has also
      failed). Or it might set device as failed for extensive read
      errors if the user tuned profile demands it.


A btrfs pool can be in one of the state:

Online:
   All the chunks are as configured.

Degraded:
   One or more logical-chunks does not meet the redundancy level that
   user requested / configured.

Failed:
   One or more logical-chunk is incomplete. FS will be in a RO mode Or
   panic -dump as configured.


Flow diagram (also include pool states BTRFS_POOL_STATE_xx along with
device state BTRFS_DEVICE_STATE_xx):


                     [1]
                     BTRFS_DEVICE_STATE_ONLINE,
                      BTRFS_POOL_STATE_ONLINE
                                 |
                                 |
                                 V
                           new IO error
                                 |
                                 |
                                 V
                    check with block layer to know
                   if confirmed media/target:- failed
                 or fix-able transport issue:- offline.
                       and apply user config.
             can be ignored ?  --------------yes->[1]
                                 |
                                 |no
         _______offline__________/\______failed________
         |                                             |
         |                                             |
         V                                             V
(eg: transport issue [*], disk is good)     (eg: write media error)
         |                                             |
         |                                             |
         V                                             V
BTRFS_DEVICE_STATE_OFFLINE                BTRFS_DEVICE_STATE_FAILED
         |                                             |
         |                                             |
         |______________________  _____________________|
                                \/
                                 |
                         Missing chunk ? --NO--> goto [1]
                                 |
                                 |
                          Tolerable? -NO-> FS ERROR. RO.
                                      BTRFS_POOL_STATE_FAILED->remount?
                                 |
                                 |yes
                                 V
                       BTRFS_POOL_STATE_DEGRADED --> rebalance -> [1]
                                 |
         ______offline___________|____failed_________
         |                                           |
         |                                      check priority
         |                                           |
         |                                           |
         |                                      hot spare ?
         |                                    replace --> goto [1]
         |                                           |
         |                                           | no
         |                                           |
         |                                       spare-add
(user/sys notify issue is fixed,         (manual-replace/dev-delete)
   trigger scrub/balance)                            |
         |______________________  ___________________|
                                \/
                                 |
                                 V
                                [1]


Code status:
  Part-1: Provided device transitions from online to failed/offline,
          hot spare and auto replace.
          [PATCH 00/15] btrfs: Hot spare and Auto replace

  Next,
   . Add sysfs part on top of
     [PATCH] btrfs: Introduce device pool sysfs attributes
   . POOL_STATE flow and reporting
   . Device transactions from Offline to Online
   . Btrfs-progs mainly to show device and pool states
   . Apply user tolerance level to the IO errors
----------


Thanks, Anand

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [RFC] Btrfs device and pool management (wip)
@ 2015-11-30  7:54 Anand Jain
  0 siblings, 0 replies; 15+ messages in thread
From: Anand Jain @ 2015-11-30  7:54 UTC (permalink / raw)
  To: linux-btrfs



------------
  Data center systems are generally aligned with the RAS (Reliability,
Availability and Serviceability) attributes. When it comes to Storage,
RAS applies even more because its matter of trust. In this context, one
of the primary area that a typical volume manager should be well tested
is, how well RAS attributes are maintained in the context of device
failure, and its further reporting.

  But, identifying a failed device is not a straight forward code. If
you look at some statistics performed on failed and returned disks,
most of the disks ends up being classified as NTF (No Trouble Found).
That is, host failed-and-replaced a disk even before it has actually
failed. This is not good for a cost effective setup who would want to
stretch the life of an intermittently failing device to its maximum
tenure and would want to replace only when it has confirmed dead.

  Also on the other hand, some of the data center admins would like to
mitigate the risk (of low performance at peak of their business
productions) of a potential failure, and prefer to pro-actively replace
the disk at their low business/workload hours, or they may choose to
replace a device even for read errors (mainly due to performance
reasons).

  In short a large variant of real MTF (Mean Time to Failure) for the
devices across the industries/users.


Consideration:

  - Have user-tunable to support different context of usages, which 
should be applied on top of a set of disk IO errors, and its out come 
will be to know if the disk can be failed.

  - Distinguish real disk failure (failed state) VS IO errors due to 
intermittent transport errors (offline state). (I am not sure how to do 
that yet, basically in some means, block layer could help?, RFC ?).

  - A sysfs offline interface, so as to udev update the kernel, when 
disk is pulled out.

  - Because even to fail a device it depends on the user requirements, 
btrfs IO completion threads instead of directly reacting on an IO error, 
it will continue to just report the IO error into device error 
statistics, and a spooler up on errors will apply user/system 
criticalness as provided by the user on the top, which will decide if 
the device has to be marked as failed OR if it can continue to be in online.

  - A FS load pattern (mostly outside of btrfs-kernel or with in 
btrfs-kernel) may pick the right time to replace the failed device, or 
to run other FS maintenance activities (balance, scrub) automatically.

  - Sysfs will help user land scripts which may want to bring device to 
offline or failed.



Device State flow:

   A device in the btrfs kernel can be in any one of following state:

   Online
      A normal healthy device

   Missing
      Device wasn't found that the time of mount OR device scan.

   Offline (disappeared)
      Device was present at some point in time after the FS was mounted,
      however offlined by user or block layer or hot unplug or device
      experienced transport error. Basically due to any error other than
      media error.
      The device in offline state are not candidate for the replace.
      Since still there is a hope that device may be restored to online
      at some point in time, by user or transport-layer error recovery.
      For device pulled out, there will be udev script which will call
      offline through sysfs. In the long run, we would also need to know
      the block layer to distinguish from the transient write errors
      like writes failing  due to transport error, vs write errors which
      are confirmed as target-device/device-media failure.

   Failed
      Device has confirmed a write/flush failure for at least a block.
      (In general the disk/storage FW will try to relocate the bad block
      on write, it happens automatically and transparent even to the
      block layer. Further there might have been few retry from the block
      layer. And here btrfs assumes that such an attempt has also
      failed). Or it might set device as failed for extensive read
      errors if the user tuned profile demands it.


A btrfs pool can be in one of the state:

Online:
   All the chunks are as configured.

Degraded:
   One or more logical-chunks does not meet the redundancy level that
   user requested / configured.

Failed:
   One or more logical-chunk is incomplete. FS will be in a RO mode Or
   panic -dump as configured.


Flow diagram (also include pool states BTRFS_POOL_STATE_xx along with 
device state BTRFS_DEVICE_STATE_xx):


                     [1]
                     BTRFS_DEVICE_STATE_ONLINE,
                      BTRFS_POOL_STATE_ONLINE
                                 |
                                 |
                                 V
                           new IO error
                                 |
                                 |
                                 V
                    check with block layer to know
                   if confirmed media/target:- failed
                 or fix-able transport issue:- offline.
                       and apply user config.
			can be ignored ?  --------------yes->[1]
                                 |
                                 |no
         _______offline__________/\______failed________
         |                                             |
         |                                             |
         V                                             V
(eg: transport issue [*], disk is good)     (eg: write media error)
         |                                             |
         |                                             |
         V                                             V
BTRFS_DEVICE_STATE_OFFLINE                BTRFS_DEVICE_STATE_FAILED
         |                                             |
         |                                             |
         |______________________  _____________________|
                                \/
                                 |
                         Missing chunk ? --NO--> goto [1]
                                 |
                                 |
                          Tolerable? -NO-> FS ERROR. RO.
                                      BTRFS_POOL_STATE_FAILED->remount?
                                 |
                                 |yes
                                 V
                       BTRFS_POOL_STATE_DEGRADED --> rebalance -> [1]
                                 |
         ______offline___________|____failed_________
         |                                           |
         |                                      check priority
         |                                           |
         |                                           |
         |                                      hot spare ?
         |                                    replace --> goto [1]
         |                                           |
         |                                           | no
         |                                           |
         |                                       spare-add
(user/sys notify issue is fixed,         (manual-replace/dev-delete)
   trigger scrub/balance)                            |
         |______________________  ___________________|
                                \/
                                 |
                                 V
                                [1]


Code status:
  Part-1: Provided device transitions from online to failed/offline,
          hot spare and auto replace.
          [PATCH 00/15] btrfs: Hot spare and Auto replace

  Next,
   . Add sysfs part on top of
     [PATCH] btrfs: Introduce device pool sysfs attributes
   . POOL_STATE flow and reporting
   . Device transactions from Offline to Online
   . Btrfs-progs mainly to show device and pool states
   . Apply user tolerance level to the IO errors
----------


Thanks, Anand


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-12-09  4:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30  7:59 [RFC] Btrfs device and pool management (wip) Anand Jain
2015-11-30 12:43 ` Qu Wenruo
2015-12-01 18:01   ` Goffredo Baroncelli
2015-12-01 23:43     ` Qu Wenruo
2015-12-02 19:07       ` Goffredo Baroncelli
2015-12-02 23:36         ` Qu Wenruo
2015-11-30 14:51 ` Austin S Hemmelgarn
2015-11-30 20:17   ` Chris Murphy
2015-11-30 20:37     ` Austin S Hemmelgarn
2015-11-30 21:09       ` Chris Murphy
2015-12-01 10:05         ` Brendan Hide
2015-12-01 13:11           ` Brendan Hide
2015-12-09  4:39     ` Christoph Anton Mitterer
2015-12-01  0:43   ` Qu Wenruo
  -- strict thread matches above, loose matches on Subject: below --
2015-11-30  7:54 Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).