diff mbox

[03/22] mm/shmem: parse mount options for MS_KERNMOUNT

Message ID 20170925184737.8807-4-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matthew Auld Sept. 25, 2017, 6:47 p.m. UTC
In i915 we now have our own tmpfs mount, so ensure that shmem_fill_super
also calls shmem_parse_options when dealing with a kernel mount.
Otherwise we have to clumsily call remount_fs when we want to supply our
mount options.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: linux-mm@kvack.org
---
 mm/shmem.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Chris Wilson Sept. 25, 2017, 7:28 p.m. UTC | #1
Quoting Matthew Auld (2017-09-25 19:47:18)
> In i915 we now have our own tmpfs mount, so ensure that shmem_fill_super
> also calls shmem_parse_options when dealing with a kernel mount.
> Otherwise we have to clumsily call remount_fs when we want to supply our
> mount options.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Kirill A. Shutemov <kirill@shutemov.name>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: linux-mm@kvack.org

I could not find a counter argument why all kernel users had to skip
shmem_parse_options(), is there a danger that data may be anything other
than a string or NULL?
-Chris
diff mbox

Patch

diff --git a/mm/shmem.c b/mm/shmem.c
index ae2e46291ffa..6074e527b9b9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3781,13 +3781,15 @@  int shmem_fill_super(struct super_block *sb, void *data, int silent)
 	if (!(sb->s_flags & MS_KERNMOUNT)) {
 		sbinfo->max_blocks = shmem_default_max_blocks();
 		sbinfo->max_inodes = shmem_default_max_inodes();
-		if (shmem_parse_options(data, sbinfo, false)) {
-			err = -EINVAL;
-			goto failed;
-		}
 	} else {
 		sb->s_flags |= MS_NOUSER;
 	}
+
+	if (shmem_parse_options(data, sbinfo, false)) {
+		err = -EINVAL;
+		goto failed;
+	}
+
 	sb->s_export_op = &shmem_export_ops;
 	sb->s_flags |= MS_NOSEC;
 #else