From: Petr Lautrbach <lautrbach@redhat.com>
To: Cathy Hu <cahu@suse.de>, selinux@vger.kernel.org
Cc: Cathy Hu <cahu@suse.de>
Subject: Re: [PATCH] restorecon: Only log error on readonly fs (bsc#1257996)
Date: Mon, 27 Apr 2026 18:52:57 +0200 [thread overview]
Message-ID: <875x5ctkeu.fsf@redhat.com> (raw)
In-Reply-To: <20260310153249.2077092-3-cahu@suse.de>
Cathy Hu <cahu@suse.de> writes:
> Signed-off-by: Cathy Hu <cahu@suse.de>
> ---
> RFC Patch for the issue described in thread "Question regarding restorecon and btrfs read-only snapshots"
>
Could you point me where I can find the thread and is bsc#1257996?
What's the expected outcome? Before this change I see:
$ sudo restorecon -R -v /mnt/
restorecon: Could not set context for /mnt: Read-only file system
restorecon: Could not set context for /mnt/lost+found: Read-only file system
restorecon: Could not set context for /mnt/a: Read-only file system
restorecon: Could not set context for /mnt/1: Read-only file system
After:
$ sudo restorecon -R -v /mnt/
Read only filesystem, relabel not possible: /mnt
Read only filesystem, relabel not possible: /mnt/lost+found
Read only filesystem, relabel not possible: /mnt/a
Read only filesystem, relabel not possible: /mnt/1
This seems to be only a cosmetic change.
Petr
> libselinux/src/selinux_restorecon.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
> index 8fadf4d2..e8545e27 100644
> --- a/libselinux/src/selinux_restorecon.c
> +++ b/libselinux/src/selinux_restorecon.c
> @@ -774,10 +774,14 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
> if (!flags->nochange) {
> if (lsetfilecon(pathname, newcon) < 0) {
> /* Ignore files removed during relabeling if ignore_noent is set */
> - if (flags->ignore_noent && errno == ENOENT)
> + if (flags->ignore_noent && errno == ENOENT) {
> goto out;
> - else
> + } else if (errno == EROFS) {
> + selinux_log(SELINUX_INFO, "Read only filesystem, relabel not possible: %s\n", pathname);
> + goto out;
> + } else {
> goto err;
> + }
> }
>
> updated = true;
> --
> 2.53.0
next prev parent reply other threads:[~2026-04-27 16:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 15:32 [PATCH] restorecon: Only log error on readonly fs (bsc#1257996) Cathy Hu
2026-04-27 16:52 ` Petr Lautrbach [this message]
2026-04-28 9:18 ` Cathy Hu
2026-04-28 10:44 ` Petr Lautrbach
2026-04-30 10:58 ` Cathy Hu
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=875x5ctkeu.fsf@redhat.com \
--to=lautrbach@redhat.com \
--cc=cahu@suse.de \
--cc=selinux@vger.kernel.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.