On Tue, Sep 07, 2021 at 08:14:25PM +0800, Xie Yongji wrote: > When a nbd device encounters a writeback error, that error will > get propagated to the bd_inode's wb_err field. Then if this nbd > device's backend is disconnected and another is attached, we will > get back the previous writeback error on fsync, which is unexpected. > To fix it, let's clear out the wb_err on disconnect. I really do not like how internals of the implementation like into drivers here. Can you add a block layer helper to clear any state instead? This should incude e.g. the size just cleared above and should also be used by the loop driver as well.