From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Al Viro <viro@zeniv.linux.org.uk>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCHv2] devpts: fix to set default values of mount options
Date: Fri, 15 May 2009 13:25:36 +0800 [thread overview]
Message-ID: <4A0CFCD0.70605@cn.fujitsu.com> (raw)
In-Reply-To: <4A0CFB90.3060109@cn.fujitsu.com>
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
next prev parent reply other threads:[~2009-05-15 5:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 5:20 [PATCH] devpts: fix to set default values of mount options Wei Yongjun
2009-05-15 5:25 ` Wei Yongjun [this message]
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
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A0CFCD0.70605@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.