ramfs: ignore tmpfs options when we emulate it
PATCH 1/1 ramfs: ignore tmpfs options when we emulate it
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
---
another option might be to restore the previous behavior where ramfs simply ignored all unknown mount options ...
fs/ramfs/inode.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
fs/ramfs/inode.c +10 -0
@@ -203,6 +203,16 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts) opts->mode = option &S_IALLUGO ;break ;default : +#ifndef CONFIG_SHMEM +/* If tmpfs is using us to emulate it, ignore its options */ +if (!strncmp (p,"gid=" ,4 ) || + !strncmp (p,"mpol=" ,5 ) || + !strncmp (p,"nr_blocks=" ,10 ) || + !strncmp (p,"nr_inodes=" ,10 ) || + !strncmp (p,"size=" ,5 ) || + !strncmp (p,"uid=" ,4 )) +continue ; +#endif printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);return -EINVAL ; }
Signature · 1 line
1.6.3.1
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with CONFIG_SHMEM (perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch with mm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 5 lines
This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
I rather think the correct response to bugzilla #12843 should have been to say, either use chmod 1777 yourself, or use CONFIG_SHMEM=y. I fear we'll now get a line of requests for support of uid, gid, ... in ramfs; whereas ramfs is about blind simplicity, not feature bloat. However, that mode= feature is now in, so I guess we ride with it.
Quoted 5 lines
Signed-off-by Mike Frysinger <[email protected]>---
another option might be to restore the previous behavior where ramfs simply ignored all unknown mount options ...
Yes, that would be my preference, return to the blind simplicity, with that one exception for mode=. Alternative patch suggested at the bottom, let's see if Cc's added feel strongly about it one way or another.
Thanks,
Hugh
Quoted 27 lines
fs/ramfs/inode.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)fs/ramfs/inode.c +10
-0@@ -203,6 +203,16 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts) opts->mode = option &S_IALLUGO ;break ;default : +#ifndef CONFIG_SHMEM +/* If tmpfs is using us to emulate it, ignore its options */ +if (!strncmp (p,"gid=" ,4 ) || + !strncmp (p,"mpol=" ,5 ) || + !strncmp (p,"nr_blocks=" ,10 ) || + !strncmp (p,"nr_inodes=" ,10 ) || + !strncmp (p,"size=" ,5 ) || + !strncmp (p,"uid=" ,4 )) +continue ; +#endif printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);return -EINVAL ; }Signature · 1 line
1.6.3.1
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ramfs/inode.c +6 -3
@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; -default : -printk (KERN_ERR "ramfs: bad mount option: %s\n" , p); -return -EINVAL ; +/* +* We might like to report bad mount options here; +* but traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, better continue to ignore other mount options. +*/ } }
Quoted 9 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
agreed
Quoted 10 lines
Quoted 4 lines
This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argumentI rather think the correct response to bugzilla #12843 should have been to say, either use chmod 1777 yourself, or use
CONFIG_SHMEM=y. I fear we'll now get a line of requests for support of uid, gid, ... in ramfs; whereas ramfs is about blind simplicity, not feature bloat. However, that mode= feature is now in, so I guess we ride with it.
i thought the bug report a bit odd in more than just this regard. glad to see i'm not the only one ;).
Quoted 6 lines
Quoted 2 lines
another option might be to restore the previous behavior where ramfs simply ignored all unknown mount options ...
Yes, that would be my preference, return to the blind simplicity, with that one exception for mode=. Alternative patch suggested at the bottom, let's see if Cc's added feel strongly about it one way or another.
i'm OK with either approach, thanks !
-mike
Matt Mackall
Acked-byQuoted 24 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.Quoted 5 lines
This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Quoted 5 lines
I rather think the correct response to bugzilla #12843 should have been to say, either use chmod 1777 yourself, or use
CONFIG_SHMEM=y. I fear we'll now get a line of requests for support of uid, gid, ... in ramfs; whereas ramfs is about blind simplicity, not feature bloat. However, that mode= feature is now in, so I guess we ride with it.
Ugh, hadn't noticed that go by.
Quoted 60 lines
Quoted 5 lines
Signed-off-by Mike Frysinger <[email protected]>---
another option might be to restore the previous behavior where ramfs simply ignored all unknown mount options ...Yes, that would be my preference, return to the blind simplicity, with that one exception for mode=. Alternative patch suggested at the bottom, let's see if Cc's added feel strongly about it one way or another.
Thanks,
HughQuoted 27 lines
fs/ramfs/inode.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)fs/ramfs/inode.c +10
-0@@ -203,6 +203,16 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts) opts->mode = option &S_IALLUGO ;break ;default : +#ifndef CONFIG_SHMEM +/* If tmpfs is using us to emulate it, ignore its options */ +if (!strncmp (p,"gid=" ,4 ) || + !strncmp (p,"mpol=" ,5 ) || + !strncmp (p,"nr_blocks=" ,10 ) || + !strncmp (p,"nr_inodes=" ,10 ) || + !strncmp (p,"size=" ,5 ) || + !strncmp (p,"uid=" ,4 )) +continue ; +#endif printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);return -EINVAL ; }Signature · 1 line
1.6.3.1[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Quoted 5 lines
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
Signed-off-by Mike Frysinger <[email protected]>Signed-off-by Hugh Dickins <[email protected]>
Signature · 1 line
http://selenic.com : development and support for Mercurial and Linux
Wu Fengguang
Acked-by Matt MackallQuoted 10 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
Thanks,
Fengguang
---
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ramfs/inode.c +8 -0
@@ -202,9 +202,17 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; +#ifndef CONFIG_SHMEM +/* +* We might like to report bad mount options here; +* but traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, better continue to ignore other mount options. +*/ default :printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);return -EINVAL ; +#endif } }
Quoted 18 lines · Wu Fengguang
Quoted 9 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
i think Hugh's suggestion to change the behavior of ramfs back to the way it has always been (ignore unknown options) is the way to go rather than making it change behavior based on configuration -mike
Quoted 19 lines · Mike Frysinger
Quoted 18 lines · Wu Fengguang
Quoted 16 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 7 lines
Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
i think Hugh's suggestion to change the behavior of ramfs back to the way it has always been (ignore unknown options) is the way to go rather than making it change behavior based on configuration
Right. I've just posted a new patch. Does that make sense to you?
Thanks,
Fengguang
Quoted 19 lines · Wu Fengguang
Quoted 10 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
We could do; but I'm still preferring not. How about you, Matt? You decide, I think Andrew has chosen a different race track from "The Merge Window" this weekend.
Either of our patches (or Mike's orginal) fixes Mike's actual problem:
but I'd rather keep ramfs as close as we can to its original behaviour, and as simple as possible; not making it behave differently in the CONFIG_SHMEM=y and CONFIG_SHMEM=n cases (you can still "mount -t ramfs" when ramfs is also being used to serve "mount -t tmpfs").
Quoted 22 lines
Thanks,
Fengguang---
[PATCH] ramfs: ignore unknown mount optionsFrom: Mike Frysinger <[email protected]>
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Quoted 6 lines
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
Acked-by Matt Mackall <[email protected]>Signed-off-by Mike Frysinger <[email protected]>Signed-off-by Hugh Dickins <[email protected]>
Sorry, no, this one is not yet Signed-off-by me (nor Acked yet by Matt). Though I admit we're arguing over a trifle!
Hugh
Quoted 26 lines
Signed-off-by Wu Fengguang <[email protected]>---
fs/ramfs/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)fs/ramfs/inode.c +8
-0@@ -202,9 +202,17 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; +#ifndef CONFIG_SHMEM +/* +* We might like to report bad mount options here; +* but traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, better continue to ignore other mount options. +*/ default :printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);return -EINVAL ; +#endif } }
Wu Fengguang
Acked-by Matt MackallQuoted 28 lines · Hugh Dickins
Quoted 19 lines · Wu Fengguang
Quoted 10 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
We could do; but I'm still preferring not. How about you, Matt? You decide, I think Andrew has chosen a different race track from "The Merge Window" this weekend.
Quoted 5 lines
Either of our patches (or Mike's orginal) fixes Mike's actual problem:
but I'd rather keep ramfs as close as we can to its original behaviour, and as simple as possible; not making it behave differently in theCONFIG_SHMEM=yandCONFIG_SHMEM=ncases (you can still "mount -t ramfs" when ramfs is also being used to serve "mount -t tmpfs").
Right. Compatibility and simplicity makes sense. Do you agree to emit a warning message though? This updated patch changes KERN_ERR to KERN_WARNING.
Thanks,
Fengguang
---
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/ramfs/inode.c +7 -2
@@ -202,9 +202,14 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; +/* +* Traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, ignore other mount options with a warning. +*/ default : -printk (KERN_ERR "ramfs: bad mount option: %s\n" , p); -return -EINVAL ; +printk (KERN_WARNING "ramfs: bad mount option: %s\n" , p); +break ; } }
Quoted 20 lines · Hugh Dickins
Quoted 19 lines · Wu Fengguang
Quoted 17 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 7 lines
Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
We could do; but I'm still preferring not. How about you, Matt? You decide, I think Andrew has chosen a different race track from "The Merge Window" this weekend.
I prefer the 'silently ignore' approach.
The only other approach that I think is reasonably clean is to 'subclass' ramfs by wrapping its init function with one that discards mount args. Unfortunately that adds code and data in the 'I don't give a damn, just keep it tiny' case, so that's a non-starter.
Signature · 1 line
http://selenic.com : development and support for Mercurial and Linux
PATCH 1/1 ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ramfs/inode.c +6 -3
@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; -default : -printk (KERN_ERR "ramfs: bad mount option: %s\n" , p); -return -EINVAL ; +/* +* We might like to report bad mount options here; +* but traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, better continue to ignore other mount options. +*/ } }
Wu Fengguang
Acked-by Matt MackallQuoted 19 lines · Wu Fengguang
Quoted 10 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Quoted 7 lines
Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
Quoted 3 lines
We can avoid the burden of syncing a list of options between ramfs<>tmpfs by a slightly differently patch. Hopefully this makes ramfs behave like other filesystems when used standalone.
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.
Thanks,
Fengguang
---
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ramfs/inode.c +6 -1
@@ -202,9 +202,14 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; +/* +* Traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, ignore other mount options with a warning. +*/ default :printk (KERN_ERR "ramfs: bad mount option: %s\n" , p); -return -EINVAL ; +break ; } }
fs/ramfs/inode.c static int ramfs_parse_options(char *dat · line 212
Quoted 9 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.default: printk(KERN_ERR "ramfs: bad mount option: %s\n", p);fs/ramfs/inode.c +1
-1-return -EINVAL ; +break ;
hmm, if the warning was wrapped in #ifdef CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.
-mike
Wu Fengguang
Acked-by Matt MackallQuoted 6 lines · Mike Frysinger
Quoted 5 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.
Quoted 8 lines
Review
Quoted 4 lines
default: printk(KERN_ERR "ramfs: bad mount option: %s\n", p);(quoted diff) +1
-1- return -EINVAL; + break;hmm, if the warning was wrapped in #ifdef
CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.
We may change the "ramfs:" accordingly. But *silently* ignoring options is bad anyway?
Does this message look better?
+ printk(KERN_WARNING "%s: ignoring mount option: %s\n",
+ sb->s_id, p);
Thanks,
Fengguang
---
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.
This used to work before commit c3b1b1cbf0 as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argument
Another option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
---
fs/ramfs/inode.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/ramfs/inode.c +11 -4
@@ -182,8 +182,9 @@ struct ramfs_fs_info {struct ramfs_mount_opts mount_opts; }; -static int ramfs_parse_options (char *data,struct ramfs_mount_opts *opts) +static int ramfs_parse_options (struct super_block *sb,char *data) { +struct ramfs_mount_opts *opts = sb->s_fs_info;substring_t args[MAX_OPT_ARGS ];int option;int token;
@@ -202,9 +203,15 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; +/* +* Traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, ignore other mount options with a warning. +*/ default : -printk (KERN_ERR "ramfs: bad mount option: %s\n" , p); -return -EINVAL ; +printk (KERN_WARNING "%s: ignoring mount option: %s\n" , + sb->s_id, p); +break ; } }
@@ -227,7 +234,7 @@ static int ramfs_fill_super(struct super goto fail; } - err =ramfs_parse_options (data, &fsi->mount_opts); + err =ramfs_parse_options (sb, data);if (err) goto fail;
Quoted 12 lines · Wu Fengguang
Quoted 11 lines · Mike Frysinger
Quoted 9 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.default:
printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
- return-EINVAL;
+ break;
Quoted 6 lines
Quoted 3 lines
hmm, if the warning was wrapped in #ifdef
CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.We may change the "ramfs:" accordingly. But *silently* ignoring options is bad anyway?
i really hate nitpicking such minor shit, but reality is that output displayed in the kernel log that is incorrect is going to cause me grief via customer support, updating documentation, adding FAQs, etc... and i doubt i'm the only one here.
my requirement is simple: valid tmpfs options should be silently consumed (i.e. ignored) when tmpfs is being emulated by ramfs (i.e. CONFIG_SHMEM=n).
so how about:
default:
if (!strcmp(sb->s_id, "ramfs"))
printk(KERN_WARNING "%s: ignoring mount option: %s\n", sb->s_id, p);
break;-mike
Quoted 17 lines · Mike Frysinger
Quoted 16 lines · Wu Fengguang
Quoted 14 lines · Mike Frysinger
Quoted 9 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.default:
printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
- return-EINVAL;
+ break;hmm, if the warning was wrapped in #ifdef
CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.
Quoted 7 lines
Quoted 2 lines
We may change the "ramfs:" accordingly. But *silently* ignoring options is bad anyway?
i really hate nitpicking such minor shit, but reality is that output displayed in the kernel log that is incorrect is going to cause me grief via customer support, updating documentation, adding FAQs, etc... and i doubt i'm the only one here.
I don't think the message is "incorrect" - it is reminding user the fact.
But I didn't know that ignorant users will ask you for customer support on the "new" warning. Sorry.
Quoted 9 lines
my requirement is simple: valid tmpfs options should be silently consumed (i.e. ignored) when tmpfs is being emulated by ramfs (i.e.
CONFIG_SHMEM=n).so how about:
default:if (!strcmp(sb->s_id, "ramfs")) printk(KERN_WARNING "%s: ignoring mount option: %s\n", sb->s_id, p); break;
This is going overly complex, maybe we just revert to Hugh's original patch for *complete* compatibility? Sorry for making a fuss.
Thanks,
Fengguang
Quoted 21 lines · Wu Fengguang
Quoted 20 lines · Mike Frysinger
Quoted 18 lines · Wu Fengguang
Quoted 6 lines · Mike Frysinger
Quoted 5 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.Quoted 8 lines
Quoted 4 lines
default:
printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
- return-EINVAL;
+ break;hmm, if the warning was wrapped in #ifdef
CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.We may change the "ramfs:" accordingly. But *silently* ignoring options is bad anyway?
Quoted 6 lines
Quoted 4 lines
i really hate nitpicking such minor shit, but reality is that output displayed in the kernel log that is incorrect is going to cause me grief via customer support, updating documentation, adding FAQs, etc... and i doubt i'm the only one here.
I don't think the message is "incorrect" - it is reminding user the fact.
when talking about ramfs, the message is correct -- the option is wrong. when talking about tmpfs emulated by ramfs, that may be a matter of opinion. i can understand why you still prefer a warning, but there is a significant body of people out there (myself including) that views warnings generally as something that should be addressed. ignoring that, people who see warnings and dont understand what's going on will ask/complain/whatever to someone somewhere. including an explanatory message along side the warning will make that number go down, but it wont go away, and it sucks to have to do that. ive seen people ask questions where they copy & paste error messages that already included explanatory text in it telling them how to fix/resolve/research the issue. i'm sure you have too :).
Quoted 4 lines
Quoted 4 lines
my requirement is simple: valid tmpfs options should be silently consumed (i.e. ignored) when tmpfs is being emulated by ramfs (i.e.
CONFIG_SHMEM=n).
Quoted 8 lines
Quoted 5 lines
so how about:
default:
if (!strcmp(sb->s_id, "ramfs"))
printk(KERN_WARNING "%s: ignoring mount option: %s\n", sb->s_id, p); break;This is going overly complex, maybe we just revert to Hugh's original patch for *complete* compatibility?
if my basic requirement is met, i dont care much about the details beyond that :).
-mike
Quoted 27 lines · Mike Frysinger
Quoted 26 lines · Wu Fengguang
Quoted 24 lines · Mike Frysinger
Quoted 12 lines · Wu Fengguang
Quoted 11 lines · Mike Frysinger
Quoted 9 lines · Wu Fengguang
On Sun, Jun 14, 2009 at 06:01:10PM +0800, Wu Fengguang wrote:
Sorry I take back the previous patch. It makes sense to not break existing user space tools, but a warning message looks OK to remind people of possibly unexpected behavior.default:
printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
- return-EINVAL;
+ break;Quoted 6 lines
Quoted 3 lines
hmm, if the warning was wrapped in #ifdef
CONFIG_SHMEM, i'd be ok with this. otherwise we end up with warnings that can (should) be ignored when tmpfs is being emulated with ramfs.We may change the "ramfs:" accordingly. But *silently* ignoring options is bad anyway?
i really hate nitpicking such minor shit, but reality is that output displayed in the kernel log that is incorrect is going to cause me grief via customer support, updating documentation, adding FAQs, etc... and i doubt i'm the only one here.
Quoted 7 lines
Quoted 1 line
I don't think the message is "incorrect" - it is reminding user the fact.
when talking about ramfs, the message is correct -- the option is wrong. when talking about tmpfs emulated by ramfs, that may be a matter of opinion. i can understand why you still prefer a warning, but there is a significant body of people out there (myself including) that views warnings generally as something that should be addressed.
Right. It will upset me, too. It's kind of this situation: "I knew it (that the option takes no effect), but please shut up!" ;-)
Quoted 4 lines
ignoring that, people who see warnings and dont understand what's going on will ask/complain/whatever to someone somewhere. including an explanatory message along side the warning will make that number go down, but it wont go away, and it sucks to have to do that. ive seen
Yes that's truth. People are often ignoring.
Quoted 3 lines
people ask questions where they copy & paste error messages that already included explanatory text in it telling them how to fix/resolve/research the issue. i'm sure you have too :).
Too bad this happened to me countless times..
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
my requirement is simple: valid tmpfs options should be silently consumed (i.e. ignored) when tmpfs is being emulated by ramfs (i.e.
CONFIG_SHMEM=n).so how about:
default:
if (!strcmp(sb->s_id, "ramfs"))
printk(KERN_WARNING "%s: ignoring mount option: %s\n", sb->s_id, p); break;
Quoted 5 lines
Quoted 2 lines
This is going overly complex, maybe we just revert to Hugh's original patch for *complete* compatibility?
if my basic requirement is met, i dont care much about the details beyond that :).
OK. Let's do it the Hugh way. Thanks for the explanations!
Thanks,
Fengguang
Wu Fengguang
Acked-byQuoted 18 lines · Hugh Dickins
Quoted 7 lines · Mike Frysinger
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.Yes, indeed, thanks a lot for reporting this.
But I'm uneasy with making ramfs behaviour differ with
CONFIG_SHMEM(perhaps that's silly: certainly tmpfs behaviour differs with it), and uneasy with coding a list of options we need to remember to keep in synch withmm/shmem.c. It's easier to justify ignoring all options, than rejecting some while ignoring others yet not respecting them.
[snip]
Quoted 36 lines
[PATCH] ramfs: ignore unknown mount options
From: Mike Frysinger <[email protected]>
On systems where
CONFIG_SHMEMis disabled, mounting tmpfs filesystems can fail when tmpfs options are used. This is because tmpfs creates a small wrapper around ramfs which rejects unknown options, and ramfs itself only supports a tiny subset of what tmpfs supports. This makes it pretty hard to use the same userspace systems across different configuration systems. As such, ramfs should ignore the tmpfs options when tmpfs is merely a wrapper around ramfs.This used to work before commit
c3b1b1cbf0as previously, ramfs would ignore all options. But now, we get:
ramfs: bad mount option: size=10M
mount: mounting mdev on /dev failed: Invalid argumentAnother option might be to restore the previous behavior, where ramfs simply ignored all unknown mount options ... which is what Hugh prefers.
Signed-off-by Mike Frysinger <[email protected]>Signed-off-by Hugh Dickins <[email protected]>---
fs/ramfs/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/ramfs/inode.c +0
-2@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *datreturn -EINVAL ; opts->mode = option &S_IALLUGO ;break ; -default : -printk (KERN_ERR "ramfs: bad mount option: %s\n" , p);
fs/ramfs/inode.c static int ramfs_parse_options(char *dat · line 213
Quoted 10 lines
fs/ramfs/inode.c +6
-1-return -EINVAL ; +/* +* We might like to report bad mount options here; +* but traditionally ramfs has ignored all mount options, +* and as it is used as a !CONFIG_SHMEM simple substitute +* for tmpfs, better continue to ignore other mount options. +*/ } }