Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2025 11:57:14 +0200
From:      Olivier Certner <olce@freebsd.org>
To:        Lexi Winter <ivy@freebsd.org>
Cc:        fs@freebsd.org, current@freebsd.org
Subject:   Re: openat("./...", O_CREAT) fails even though the directory exists
Message-ID:  <6142242.Zv9zXsTiuT@ravel>
In-Reply-To: <aOzF-JAOyg-T-Ule@amaryllis.le-fay.org>
References:  <aOy5LUUu5DCwY_XZ@amaryllis.le-fay.org> <2507674.THHZn3L5Ee@ravel> <aOzF-JAOyg-T-Ule@amaryllis.le-fay.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2843477.TYJnH3iKXO
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Olivier Certner <olce@freebsd.org>
To: Lexi Winter <ivy@freebsd.org>
Cc: fs@freebsd.org, current@freebsd.org
Date: Mon, 13 Oct 2025 11:57:14 +0200
Message-ID: <6142242.Zv9zXsTiuT@ravel>
In-Reply-To: <aOzF-JAOyg-T-Ule@amaryllis.le-fay.org>
MIME-Version: 1.0

> - trying to create "./df59D8I2px044288", which doesn't exist, with
>   O_CREAT|O_EXCL fails with ENOENT.

Oh, indeed, I had missed the O_CREAT|O_EXCL.  I'll grab some more caffeine...
 
> after some more debugging, i think what's going on here is that pkg(8)
> is deleting and recreating /var/spool/mqueue on upgrade, which means
> smmsp's open fd to that directory is no longer valid, and therefore
> openat() returns this unusual error.

Yes, if the directory was removed but is still open, FSes will typically return an error at lookup (which is a sub-process of creating a file there) in this directory (e.g., UFS returns ENOENT).
 
> i suspect the fix will be in pkgbase
> somewhere: for example, we could restart sendmail on upgrade, or tell
> the user to do that.

Most probably it will need too, yes.

-- 
Olivier Certner
--nextPart2843477.TYJnH3iKXO
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCQAdFiEEmNCxHjkosai0LYIujKEwQJceJicFAmjszPsACgkQjKEwQJce
JicZFxAAhoQG9zDfUsTWwPeSq+bnO0de1PpNn6XNwHzv+o0KdA84EZd0bGq8a2Wb
DiOyf4TFogqUVqJ/noStHe85CGi2DlRNMLxHtsLPT/zcao3Pgxryq1L9H8ya/Tca
gdbPKK7e9xzU7/hXCGWJmP0MCbIYjGEnbRiitknVaE4S64SpStDIaGqTLR38r/Cy
KhZOXz5tUHoacNWVoosZ3QigUleCjhdPd0GK7fGR6qY9rGSJZE/3Q4IkARF3RToR
/KTcIAmE96ThnL+ttt/0gpOwtpgJpUHkpCqqowMGx8TxEvYETI7lFeSvwEMk1MzC
eJqGvKiENmAHjuFs4Qr9tPvkNm3HgV0LfWmbeMGH8DK/DZj2H8AaT7jumlKwfemn
FJDvNPhtnfuMnWSCaKzI0i6W06NUzg/971EfBZXRb9yIHbO0QfLk5dyRK29ayfHH
wkcY1rZgr92XghDo+e4YCdeByCESkcIkBSAACdLnVFIEm17cEvEujP+/nYtty8pC
8iiGLA31cPiT6NE1tEFMSu/B07TuGoJ85v/iQ12p83JyK7qr2PFghcV4nX7kbeD5
sjFFaxyyVw1gTMWHsWy2dTZPGI68154bkZ7+Ya1eTc7HvM/Nhv6wFParKbSErQcX
+p4/O02FdZuompa+l/t88yyZR0KorMLTVyK61XcDw2Q/Ilw1DiA=
=l1g3
-----END PGP SIGNATURE-----

--nextPart2843477.TYJnH3iKXO--






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6142242.Zv9zXsTiuT>