Merge pull request #26238 from ArthurWuTW/26102

tmpfs: Add support for noatime mount option
This commit is contained in:
openshift-merge-bot[bot]
2025-07-04 10:55:02 +00:00
committed by GitHub
5 changed files with 37 additions and 3 deletions

View File

@ -8,7 +8,7 @@ t POST containers/create?name=hostconfig_test \
Image=$IMAGE \
Cmd='["df","-P","'$tmpfs_name'"]' \
HostConfig='{"Binds":["/tmp/doesnotexist:/test1"]' \
TmpFs="{\"$tmpfs_name\":\"rw\"}}" \
TmpFs="{\"$tmpfs_name\":\"rw,noatime\"}}" \
201 \
.Id~[0-9a-f]\\{64\\}
cid=$(jq -r '.Id' <<<"$output")
@ -29,3 +29,11 @@ t GET containers/${cid}/logs?stdout=true 200
# null bytes in the outfile.
like "$(tr -d \\0 <$WORKDIR/curl.result.out)" ".* ${tmpfs_name}" \
"'df' output includes tmpfs name"
# Reject 'noatime' for bind mount
t POST libpod/containers/create \
Image=$IMAGE \
Mounts='[{"type":"bind","source":"/nosuchdir","destination":"/data","options":["noatime"]}]' \
500 \
.cause="invalid mount option" \
.message~"the 'noatime' option is only allowed with tmpfs mounts"

View File

@ -1131,4 +1131,18 @@ RUN chmod 755 /test1 /test2 /test3`, ALPINE)
outTest := podmanTest.PodmanExitCleanly("run", "--rm", "--mount", fmt.Sprintf("type=volume,src=%s,dest=/mnt", volName), ALPINE, "ls", "/mnt")
Expect(outTest.OutputToString()).To(ContainSubstring("testfile"))
})
It("podman run --tmpfs with noatime option", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--tmpfs", "/mytmpfs:noatime", ALPINE, "grep", "mytmpfs", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
output := session.OutputToString()
Expect(output).To(ContainSubstring("noatime"))
session = podmanTest.Podman([]string{"run", "--rm", "--tmpfs", "/mytmpfs", ALPINE, "grep", "mytmpfs", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
output = session.OutputToString()
Expect(output).ToNot(ContainSubstring("noatime"))
})
})