On Wed, Sep 22, 2021 at 08:37:11PM +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 use invalidate_disk() helper to invalidate the > disk on disconnect instead of just setting disk's capacity to zero. Looks good, Reviewed-by: Christoph Hellwig <hch@xxxxxx>