@@ -221,7 +221,12 @@ func (p *btrfsPool) removeVolume(root string) error {
221221
222222 qgroupID := fmt .Sprintf ("0/%d" , info .ID )
223223 if err := p .utils .QGroupDestroy (ctx , qgroupID , p .Path ()); err != nil {
224- return errors .Wrapf (err , "failed to delete qgroup %s" , qgroupID )
224+ // we log here and not return an error because
225+ // - qgroup deletion can fail because it is still used by the system
226+ // even if the volume is gone
227+ // - failure to delete a qgroup is not a fatal error
228+ log .Warn ().Err (err ).Str ("group-id" , qgroupID ).Msg ("failed to delete qgroup" )
229+ return nil
225230 }
226231
227232 return nil
@@ -265,6 +270,7 @@ func (p *btrfsPool) Usage() (usage Usage, err error) {
265270 return
266271}
267272
273+ // TODO: we need to run this periodically for each pool
268274func (p * btrfsPool ) maintenance () error {
269275 // this method cleans up all the unused
270276 // qgroups that could exists on a filesystem
@@ -292,7 +298,7 @@ func (p *btrfsPool) maintenance() error {
292298 if ! ok {
293299 log .Debug ().Str ("id" , qgroupID ).Msg ("destroy qgroup" )
294300 if err := p .utils .QGroupDestroy (ctx , qgroupID , p .Path ()); err != nil {
295- return err
301+ log . Warn (). Err ( err ). Str ( "group-id" , qgroupID ). Msg ( "failed to destroy unused group" )
296302 }
297303 }
298304 }
0 commit comments