unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Chris Marusich <cmmarusich@gmail.com>
Cc: 41607@debbugs.gnu.org, Stephen Scheck <singularsyntax@gmail.com>
Subject: bug#41607: Deleted store items are not actually deleted
Date: Thu, 04 Jun 2020 13:58:17 +0200	[thread overview]
Message-ID: <87eeqvcaau.fsf@gnu.org> (raw)
In-Reply-To: <87r1v0k8hl.fsf@gmail.com> (Chris Marusich's message of "Sat, 30 May 2020 21:56:38 -0700")

Hi,

Chris Marusich <cmmarusich@gmail.com> skribis:

> The reason Guix is failing to GC dead items in the Docker container is
> because those dead items are not on the "top layer", so Docker returns
> an EXDEV error:
>
> https://docs.docker.com/storage/storagedriver/overlayfs-driver/
>
> "Renaming directories: Calling rename(2) for a directory is allowed only
> when both the source and the destination path are on the top
> layer. Otherwise, it returns EXDEV error ('cross-device link not
> permitted'). Your application needs to be designed to handle EXDEV and
> fall back to a 'copy and unlink' strategy."
>
> You can observe this by running guix-daemon with strace in the
> container, and watching what happens when you try to delete one of the
> offending store items (make sure it is a directory).  For example:
>
> 685   rename("/gnu/store/xib50iqk3w1gw9l770mad59m9bi3bcpc-manual-database", "/gnu/store/trash/xib50iqk3w1gw9l770mad59m9bi3bcpc-manual-database") = -1 EXDEV (Invalid cross-device link)
>
> In most cases, when guix-daemon GC's a dead directory, it does this
> (see: nix/libstore/gc.cc):
>
> - Create a trash directory (usually /gnu/store/trash)
> - Move dead directories into the trash directory.
> - Delete the trash directory.
>
> The trash directory is on the "top layer" because it gets created in the
> running container.  However, in practice many store items from lower
> layers are made dead when Stephen's script runs "guix pull" and deletes
> the old profiles.  If any of those store items were directories,
> guix-daemon will fail to GC them because of an XDEV error.  If this is
> confusing to you, I suggest you experiment with Docker a little bit, and
> look closely at the steps that Stephen's script is running.  I outlined
> this in the email I accidentally deleted, but I'm a little too tired to
> reproduce it all a second time.  I hope you'll understand.

Interesting, thanks for the analysis!

> Should Guix do anything about this?  We could change guix-daemon to take
> correct action in the face of an XDEV error.  We could also improve the
> logging, since currently it silently swallows the XDEV error.

I guess we could delete recursively right away upon EXDEV.  It should be
just two lines of code, right?

> To work around the issue, Stephen can build the images from the same
> base image, rather than daisy-chaining new images from old ones.  That
> way, they would not accumulate layers without bound.

Maybe that too.

Thanks,
Ludo’.




  parent reply	other threads:[~2020-06-04 11:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKjnHz1X26QhPEWZfOmAbEmZHQA1qdU_Dq7U6kVXUqG7vCvuhw@mail.gmail.com>
     [not found] ` <20200528181043.GC23745@jasmine.lan>
     [not found]   ` <CAKjnHz0txxc+Bdc5=4TLLcxSmRpf2sCJswu-E36UJKvQqBA2kQ@mail.gmail.com>
     [not found]     ` <20200529170820.GA30828@jasmine.lan>
     [not found]       ` <CAKjnHz1b1EUXszQtUVz9p8zWu+h0HtPfCzrOmrXO+eyhH+AvVw@mail.gmail.com>
     [not found]         ` <20200529180245.GA3754@jasmine.lan>
     [not found]           ` <CAKjnHz0Ce=w0DZPi6xE6GNQ4-ezmvjUr+5FqxsvCBdx4SU+VsQ@mail.gmail.com>
2020-05-29 19:09             ` bug#41607: Deleted store items are not actually deleted Leo Famulari
2020-05-31  4:56               ` Chris Marusich
2020-05-31  9:27                 ` zimoun
2020-06-04 11:58                 ` Ludovic Courtès [this message]
2020-06-04 18:50                   ` Chris Marusich
2020-06-05  9:32                     ` Christopher Marusich
2020-06-05  9:36                       ` zimoun
2020-06-05 16:05                       ` Stephen Scheck
2020-06-05 16:21                       ` Ludovic Courtès
2020-06-07  1:31                         ` Chris Marusich
2020-06-07 10:07                           ` zimoun
2020-06-08  7:43                             ` Chris Marusich
     [not found] ` <CAJ3okZ0vPpPnDQavrpufPXmSZWk2h+oN2SR7CDVwaEhg-h4h6g@mail.gmail.com>
     [not found]   ` <CAKjnHz1kgwCOia5_hVYkuwaoOiJ55cATaF-Ed6_RsS-r5AELHw@mail.gmail.com>
     [not found]     ` <CAJ3okZ2MhALsxXvWGJccE8feERDf4SihtpF=68s-APQbqaUMRA@mail.gmail.com>
     [not found]       ` <CAKjnHz33fQrKa3KoQsDWh0pv-SgGZwPnn1Wgu6Kvf=SDGb2dWQ@mail.gmail.com>
     [not found]         ` <CAJ3okZ0C2_wECSG4jWq1+ZaO=vL5Zbvyo-2kStaK0cTyF3fXgA@mail.gmail.com>
     [not found]           ` <CAKjnHz35PVGM4BcJUML8=hLxXbJG-hcOg8PeZFjqCoTXe7EueQ@mail.gmail.com>
2020-05-29 23:36             ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeqvcaau.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=41607@debbugs.gnu.org \
    --cc=cmmarusich@gmail.com \
    --cc=singularsyntax@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).