If this is a Whirlpool manufactured front loader (such, Whirlpool Duet, Kenmore Elite, or Maytag Epic), and the washer halted during the wash cycle, the first step in troubleshooting this problem should be to UNPLUG the washer for AT LEAST 30 minutes. This will reset the Central Control Unit (CCU) and often correct momentary glitches in the operation program.
If the problem(s) persist, "F21" is a Long Drain error code. This is usually an indication that you may have an obstruction somewhere in the drainage system. Most commonly, this is an indication something is lodged in the drain pump or the inlet line running from the wash tub to the pump. There is a white screw off cap on the drain pump that you can remove to inspect the pump impeller and clean. The following link explains:http://www.fixya.com/support/r3608588-f21_error_code
Included is a follow-on link that explains how to check the drain pump to clean. You may also have to remove the inlet hose that runs from the bottom of the wash tub to the inlet side of the drain pump. Debris and small articles of clothing such as socks or under garments can become lodged in this area as well causing the drain cycle to fail.
NOTE: A "SUD" error code can also often occur in conjunction with the "F21" error code. This is due to air being detected in the drainage system, which can occur if the pump is not running, or if you have an obstruction BEFORE the pump. You need to remove the inlet hose from the pump to ensure it is also not blocked. Correct your drainage system fault, and the SUD error (if displayed) should go away.
NOTE: If these preliminary measures do not correct your problem, you may have to replace the drain pump. It does not take much to damage the pump impeller or motor. Since the error code is generated if the drain cycle exceeds 8 minutes, if the pump is damaged and can't pump at the required volume, the error code will continue to appear until the pump is replaced. If the pump requires replacement, the following link explains how:http://www.fixya.com/support/r3574350-replacing_the_drain_pump_in_a_front_load
These are very simple repairs that you can perform yourself without the assistance of a repairman.
If the washer door remains locked and you still cannot open it, there is a manual release you can use to retrieve items left in the wash tub. The following link explains:
If the wash tub is full of water, you may want to use a wet/dry shop vac to pull a vacuum on the drain line and drain the wash tub. This will minimize any potential mess you may have to clean up.
NOTE: The error codes are not listed in the owner's manual. For an explanation of all the error codes, each one of these washers comes with a technical data sheet inside. To access, you will need to remove the lower toe panel under the door. The access screws are located under the bottom front edge of the panel. You may have to prop the two front feet of the washer up for better access ( a 2x4 works well for this). With the screws removed, the panel should drop down, then come off. If the tech sheet isn't directly behind the panel, it will be affixed to one of the interior cabinet walls. The tech sheet lists all error code definitions, troubleshooting data, diagnostics procedures and wiring diagrams. I mention the tech sheet because you may need it to troubleshoot this error code.
Read through the information provided and if you have questions, please post back and let me know.
I hope you find this information helpful.