linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion
@ 2018-04-20 12:35 David Howells
  2018-04-20 17:03 ` Linus Torvalds
  2018-04-22 13:36 ` David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2018-04-20 12:35 UTC (permalink / raw)
  To: torvalds; +Cc: linux-fsdevel, viro, linux-kernel

In do_mount() when the MS_* flags are being converted to MNT_* flags,
MS_RDONLY got accidentally convered to SB_RDONLY.

Undo this change.

Fixes: e462ec50cb5f ("VFS: Differentiate mount flags (MS_*) from internal superblock flags")
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/namespace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index e398f32d7541..6f720ebca133 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2814,7 +2814,7 @@ long do_mount(const char *dev_name, const char __user *dir_name,
 		mnt_flags |= MNT_NODIRATIME;
 	if (flags & MS_STRICTATIME)
 		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
-	if (flags & SB_RDONLY)
+	if (flags & MS_RDONLY)
 		mnt_flags |= MNT_READONLY;
 
 	/* The default atime for remount is preservation */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion
  2018-04-20 12:35 [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion David Howells
@ 2018-04-20 17:03 ` Linus Torvalds
  2018-04-20 20:26   ` Andreas Dilger
  2018-04-22 13:36 ` David Howells
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2018-04-20 17:03 UTC (permalink / raw)
  To: David Howells; +Cc: linux-fsdevel, Al Viro, Linux Kernel Mailing List

On Fri, Apr 20, 2018 at 5:35 AM, David Howells <dhowells@redhat.com> 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?

           Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion
  2018-04-20 17:03 ` Linus Torvalds
@ 2018-04-20 20:26   ` Andreas Dilger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2018-04-20 20:26 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: David Howells, linux-fsdevel, Al Viro, Linux Kernel Mailing List

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

On Apr 20, 2018, at 11:03 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> On Fri, Apr 20, 2018 at 5:35 AM, David Howells <dhowells@redhat.com> 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)
                inode_lru_list_add(inode);
}

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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion
  2018-04-20 12:35 [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion David Howells
  2018-04-20 17:03 ` Linus Torvalds
@ 2018-04-22 13:36 ` David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2018-04-22 13:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: dhowells, linux-fsdevel, Al Viro, Linux Kernel Mailing List

Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 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?

I happened to be looking at that bit of code.

They have the saame value for the moment, but this may not always remain so.

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-22 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 12:35 [PATCH] vfs: Undo an overly zealous MS_RDONLY -> SB_RDONLY conversion David Howells
2018-04-20 17:03 ` Linus Torvalds
2018-04-20 20:26   ` Andreas Dilger
2018-04-22 13:36 ` David Howells

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