LKML Archive on
help / color / mirror / Atom feed
From: Andreas Dilger <>
To: Linus Torvalds <>
Cc: David Howells <>,
	linux-fsdevel <>,
	Al Viro <>,
	Linux Kernel Mailing List <>
Subject: Re: [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion
Date: Fri, 20 Apr 2018 14:26:13 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

On Apr 20, 2018, at 11:03 AM, Linus Torvalds <> wrote:
> On Fri, Apr 20, 2018 at 5:35 AM, David Howells <> wrote:
>> In do_mount() when the MS_* flags are being converted to MNT_* flags,
>> MS_RDONLY got accidentally convered to SB_RDONLY.
> Applied.
> I guess they have the same value (1). How did you notice? Do you have
> some patches that turn the kernel flags into a bitwise type? Or did
> you just happen on it manually?

Making s_flags and mnt_flags differently-named enums would help make
this problem more obvious (and some compilers might complain if used
incorrectly).  That also makes it more clear what kind of flags are
being passed to do_mount(), rather than "unsigned long flags".

Even while looking at the code for this, I see that s_flags is being
used incorrectly with MS_* flags all over the place:

static inline bool sb_rdonly(const struct super_block *sb) {
	return sb->s_flags & MS_RDONLY;

void inode_add_lru(struct inode *inode)
        if (!(inode->i_state & (I_DIRTY_ALL | I_SYNC |
                                I_FREEING | I_WILL_FREE)) &&
            !atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE)

A quick grep showed 243 lines matching "->s_flags.*MS_".

Cheers, Andreas

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  reply	other threads:[~2018-04-20 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 12:35 David Howells
2018-04-20 17:03 ` Linus Torvalds
2018-04-20 20:26   ` Andreas Dilger [this message]
2018-04-22 13:36 ` David Howells

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:

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

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).