patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>, devel@spectrum-os.org
Subject: Re: [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount
Date: Sat, 13 Dec 2025 15:37:36 -0500	[thread overview]
Message-ID: <3cf4c548-80e5-4790-97bd-65c5263c7301@gmail.com> (raw)
In-Reply-To: <20251213161637.510752-4-hi@alyssa.is>


[-- Attachment #1.1.1: Type: text/plain, Size: 1880 bytes --]

On 12/13/25 11:16, Alyssa Ross wrote:
> In the ideal case, these will be cleaned up when the VM running them
> exits, but there's always the possibility that there are some left
> over, in which case mount time is the perfect time to clean up, when
> we can be reasonably sure nothing else is still accessing them.
> 
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
>  host/rootfs/image/usr/bin/mount-userdata | 36 ++++++++++++++++--------
>  1 file changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/host/rootfs/image/usr/bin/mount-userdata b/host/rootfs/image/usr/bin/mount-userdata
> index 6e4ac47d..2e130b83 100755
> --- a/host/rootfs/image/usr/bin/mount-userdata
> +++ b/host/rootfs/image/usr/bin/mount-userdata
> @@ -7,18 +7,32 @@ backtick -D "" uuid {
>    blkid -o value -s UUID -- $1
>  }
>  
> -multisubstitute {
> -  importas -Siu 0
> -  importas -Siu 1
> -  importas -Siu uuid
> -}
> -
> -case $uuid {
> -  "" {
> -    fdmove -c 1 2
> -    printf "%s: '%s' does not have a UUID\n" $0 $1
> +if {
> +  multisubstitute {
> +    importas -Siu 0
> +    importas -Siu 1
> +    importas -Siu uuid
>    }
> +
> +  case $uuid {
> +    "" {
> +      fdmove -c 1 2
> +      printf "%s: '%s' does not have a UUID\n" $0 $1

Is continuing after printing this error intentional?

> +    }
> +  }
> +
> +  mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid}
> +}
> +
> +importas -Siu uuid
> +
> +if {
> +  if -t { test -d /media/${uuid}/Spectrum/data/spectrum/storage }
> +  find /media/${uuid}/Spectrum/data/spectrum/storage
> +    -mindepth 1
> +    -maxdepth 1
> +    -name tmp.*
> +    -exec rm -rf -- {} ;
>  }
>  
> -if { mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid} }
>  printf "%s\n" /media/${uuid}

-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-12-13 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 16:16 [PATCH 1/4] host/rootfs: make fs root directories shared Alyssa Ross
2025-12-13 16:16 ` [PATCH 2/4] host/rootfs: give VMs a disk-backed directory Alyssa Ross
2025-12-13 16:16 ` [PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit Alyssa Ross
2025-12-13 16:16 ` [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
2025-12-13 20:37   ` Demi Marie Obenour [this message]
2025-12-13 20:43     ` Alyssa Ross

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

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

  git send-email \
    --in-reply-to=3cf4c548-80e5-4790-97bd-65c5263c7301@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /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://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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 NNTP newsgroup(s).