On Mon, Dec 23, 2013 at 02:12:56PM +0800, Wenchao Xia wrote: > I have reconsidered the roll back process, there is many case we > should take care, so it is better to summarize a general rule to do such > cancel operations. I suggest: do a series of roll back operations, > when one fail, skip following roll back operation. For snapshot create, > the create action is: > allocate new L1 -> refcount+1 -> allocate sn_list -> update header > The mirrored rollback action can be: > deallocate L1 <- refcount-1 <- deallocate sn_list <- restore header > > When fail happens in rollback action, simply stop following ones. > If you agree, I'd like to reorganize the patch as above.
I agree. When the steps depend on each other we should skip further operations when an error is returned in the failure path. If the steps are independent we can still safely clean up the independent parts. Stefan