Removing failed disk from array that’s already been physically removed.

I removed a failed drive from a Linux software array, however, the removed disk remained part of the array erroneously. When trying to remove it with mdadm /dev/md0 --remove detatched, I found the disk was stuck with:
~# mdadm /dev/md0 --fail detached --remove detached
mdadm: hot remove failed for 8:33: Device or resource busy"
If this happens, check the details on the array:
~# mdadm -D /dev/md0
/dev/md0:
...
    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      faulty spare rebuilding
       3       8       49        3      active sync   /dev/sdd1
       4       8       65        4      active sync   /dev/sde1
       6       8       81        5      active sync   /dev/sdf1

       7       8       97        -      spare   /dev/sdg1
As you can see, the removed drive (/dev/sdc) has a partition stuck as “faulty spare rebuilding”.  When  you see this, run:
~# cat /sys/block/md0/md/sync_action
frozen
The ‘sync_action’ is ‘frozen’, which has locked up the drive/partition that’s been removed.  Run the following:
echo check > /sys/block/md0/md/sync_action
After which, when checking RAID details again, you’ll see that the new disk (/dev/sdg1) has automatically been added to the errant array, and the old (no longer present) disk has been removed from it:
~# mdadm -D /dev/md0
/dev/md0:
...
    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       7       8       97        2      active sync   /dev/sdg1
       3       8       49        3      active sync   /dev/sdd1
       4       8       65        4      active sync   /dev/sde1
       6       8       81        5      active sync   /dev/sdf1

       2       8       33        -      faulty spare
At this point, you can now remove the errant drive using the following commands
~# mdadm /dev/md0 --fail detached --remove detached
mdadm: hot removed 8:33 from /dev/md0