Restoring a jailbroken iPad 2 or iPhone 4S and keeping your iOS firmware at iOS 5.0.1 is basically impossible at this point. Since they are both A5 devices and Apple is no longer signing iOS 5.0.1, you cannot stay at or downgrade back to iOS 5.0.1.
This means if you must restore your iOS device you will lose your jailbreak until there is jailbreak released for iOS 5.1 or later. There is possibility that @iH8sn0w has found a way to downgrade A5 devices using SHSH blobs, but there has not yet been a public tool released for downgrading the firmware.
The popular tool TinyUmbrella only works on non-A5 devices and so far @iH8sn0w is the only person who has claimed to have found a way to downgrade A5 devices.
It is a good idea to save your SHSH blobs using TinyUmbrella or iFaith just in-case there is a way to downgrade in the future.
We will keep you posted if a way to downgrade back to iOS 5.0.1 becomes available.