* [PATCH] devpts: fix to set default values of mount options
@ 2009-05-15 5:20 Wei Yongjun
2009-05-15 5:25 ` [PATCHv2] " Wei Yongjun
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2009-05-15 5:20 UTC (permalink / raw)
To: Al Viro, LKML
If devpts is mounted with no option specified, the default
values of mount options will no be set. This happend in my
Fedora11Beta box when CONFIG_DEVPTS_MULTIPLE_INSTANCES is
configured in .config.
$ mkdir /dev/pts2
$ mount -t devpts devpts /dev/pts2
$ cat /proc/mounts
devpts /dev/pts2 devpts rw,relatime,mode=000,ptmxmode=000 0 0
# umount /dev/pts2
$ mount -t devpts -o gid=0 devpts /dev/pts2
$ cat /proc/mounts
devpts /dev/pts2 devpts rw,relatime,gid=0,mode=600,ptmxmode=000 0 0
This patch fixed the problem.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
fs/devpts/inode.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 21165cf..738ffdc 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -105,6 +105,9 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts)
if (op == PARSE_MOUNT)
opts->newinstance = 0;
+ if (!data)
+ return 0;
+
while ((p = strsep(&data, ",")) != NULL) {
substring_t args[MAX_OPT_ARGS];
int token;
@@ -356,11 +359,10 @@ static int devpts_get_sb(struct file_system_type *fs_type,
struct super_block *s;
memset(&opts, 0, sizeof(opts));
- if (data) {
- error = parse_mount_options(data, PARSE_MOUNT, &opts);
- if (error)
+
+ error = parse_mount_options(data, PARSE_MOUNT, &opts);
+ if (error)
return error;
- }
if (opts.newinstance)
s = sget(fs_type, NULL, set_anon_super, NULL);
--
1.5.3.8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2] devpts: fix to set default values of mount options
2009-05-15 5:20 [PATCH] devpts: fix to set default values of mount options Wei Yongjun
@ 2009-05-15 5:25 ` Wei Yongjun
2009-05-15 8:13 ` [PATCH] devpts: change the default value of devpts mode to 0620 Wei Yongjun
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2009-05-15 5:25 UTC (permalink / raw)
To: Al Viro, LKML
If devpts is mounted with no option specified, the default
values of mount options will no be set. This happend in my
Fedora11Beta box.
$ mkdir /dev/pts2
$ mount -t devpts devpts /dev/pts2
$ cat /proc/mounts
devpts /dev/pts2 devpts rw,relatime,mode=000,ptmxmode=000 0 0
# umount /dev/pts2
$ mount -t devpts -o gid=0 devpts /dev/pts2
$ cat /proc/mounts
devpts /dev/pts2 devpts rw,relatime,gid=0,mode=600,ptmxmode=000 0 0
This patch fixed this problem.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
fs/devpts/inode.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 21165cf..13392b5 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -105,6 +105,9 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts)
if (op == PARSE_MOUNT)
opts->newinstance = 0;
+ if (!data)
+ return 0;
+
while ((p = strsep(&data, ",")) != NULL) {
substring_t args[MAX_OPT_ARGS];
int token;
@@ -356,11 +359,10 @@ static int devpts_get_sb(struct file_system_type *fs_type,
struct super_block *s;
memset(&opts, 0, sizeof(opts));
- if (data) {
- error = parse_mount_options(data, PARSE_MOUNT, &opts);
- if (error)
- return error;
- }
+
+ error = parse_mount_options(data, PARSE_MOUNT, &opts);
+ if (error)
+ return error;
if (opts.newinstance)
s = sget(fs_type, NULL, set_anon_super, NULL);
--
1.5.3.8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] devpts: change the default value of devpts mode to 0620
2009-05-15 5:25 ` [PATCHv2] " Wei Yongjun
@ 2009-05-15 8:13 ` Wei Yongjun
2009-05-15 9:50 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2009-05-15 8:13 UTC (permalink / raw)
To: Al Viro, LKML
The value of devpts mode is usually set to 620 in file
/etc/fstab like this:
$grep devpts /etc/fstab
devpts /dev/pts devpts gid=5,mode=620 0 0
But the default mode value of devpts is 0600. Why not
set it to 0620? This patch change it 0620.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
fs/devpts/inode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 13392b5..33430b9 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -26,7 +26,7 @@
#define DEVPTS_SUPER_MAGIC 0x1cd1
-#define DEVPTS_DEFAULT_MODE 0600
+#define DEVPTS_DEFAULT_MODE 0620
/*
* ptmx is a new node in /dev/pts and will be unused in legacy (single-
* instance) mode. To prevent surprises in user space, set permissions of
--
1.5.3.8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] devpts: change the default value of devpts mode to 0620
2009-05-15 8:13 ` [PATCH] devpts: change the default value of devpts mode to 0620 Wei Yongjun
@ 2009-05-15 9:50 ` Alan Cox
0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2009-05-15 9:50 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Al Viro, LKML
On Fri, 15 May 2009 16:13:44 +0800
Wei Yongjun <yjwei@cn.fujitsu.com> wrote:
> The value of devpts mode is usually set to 620 in file
> /etc/fstab like this:
>
> $grep devpts /etc/fstab
> devpts /dev/pts devpts gid=5,mode=620 0 0
>
> But the default mode value of devpts is 0600. Why not
> set it to 0620? This patch change it 0620.
NAK
The default is effectively ABI so you are changing it for people using
the 0600 default and doing nothing at all useful for those with 0620
defaults in their mount tab (which btw is distro dependant policy)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-15 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 5:20 [PATCH] devpts: fix to set default values of mount options Wei Yongjun
2009-05-15 5:25 ` [PATCHv2] " Wei Yongjun
2009-05-15 8:13 ` [PATCH] devpts: change the default value of devpts mode to 0620 Wei Yongjun
2009-05-15 9:50 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox