On Thu, Feb 28, 2019 at 06:36:40PM +0800, Anand Jain wrote: > >> + if (!ret) { > >> + inode_inc_iversion(inode); > >> + inode->i_ctime = current_time(inode); > >> + set_bit(BTRFS_INODE_COPY_EVERYTHING, > >> &BTRFS_I(inode)->runtime_flags); > >> + ret = btrfs_update_inode(trans, root, inode); > >> + ASSERT(!ret); > > > > This is not right. The previous code uses BUG_ON which is also not > > right, but does not silently continue if asserts are compiled out. > > Please add proper error handling here. > > Error handling should save and undo of inode version, i_ctime and > runtime_flags. Is a new patch for this OK? and here will use BUG_ON > as in the original.
Ok, use BUG_ON, it's effectively only a code copy. The error handling could be tricky here.