On Thu, Apr 18, 2019 at 10:24:10AM +0300, Nikolay Borisov wrote: > > > On 18.04.19 г. 10:21 ч., Qu Wenruo wrote: > > There is a BUG_ON() in __clear_extent_bit() for memory allocation > > failure. > > > > While comment of __clear_extent_bit() says it can return error, but we > > always return 0. > > > > Some __clear_extent_bit() callers just ignore the return value, while > > some still expect error. > > > > Let's return proper error for this memory allocation anyway, to remove > > that BUG_ON() as a first step, so at least we can continue test. > > I remember Josef did some changes into this code and said that prealloc > shouldn't fail because this will cause mayhem down the road i.e. proper > error handling is missing. If anything I think it should be added first > and then remove the BUG_ONs. I'm ok with changing this, but it needs to be more than just one patch. Make alloc_extent_state_atomic() error injectable and then use either error-inject.py in bcc or use https://github.com/josefbacik/debug-scripts/blob/master/inject-error.py to test it and fix all the fallout from not handling lock_extent() succeeding. You can use https://github.com/josefbacik/debug-scripts/blob/master/codepaths.py to find all call sites for inject-error to make sure you are catching all the cases. Thanks, Josef
