aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devpts
diff options
context:
space:
mode:
Diffstat (limited to 'fs/devpts')
-rw-r--r--fs/devpts/inode.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index b292ed7ff1ca..50e885f84bb0 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -220,6 +220,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
220 dev_t device = MKDEV(driver->major, driver->minor_start+number); 220 dev_t device = MKDEV(driver->major, driver->minor_start+number);
221 struct dentry *dentry; 221 struct dentry *dentry;
222 struct inode *inode = new_inode(devpts_mnt->mnt_sb); 222 struct inode *inode = new_inode(devpts_mnt->mnt_sb);
223 char s[12];
223 224
224 /* We're supposed to be given the slave end of a pty */ 225 /* We're supposed to be given the slave end of a pty */
225 BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY); 226 BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY);
@@ -235,9 +236,13 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
235 init_special_inode(inode, S_IFCHR|config.mode, device); 236 init_special_inode(inode, S_IFCHR|config.mode, device);
236 inode->i_private = tty; 237 inode->i_private = tty;
237 238
238 dentry = get_node(number); 239 sprintf(s, "%d", number);
239 if (!IS_ERR(dentry) && !dentry->d_inode) { 240
240 d_instantiate(dentry, inode); 241 mutex_lock(&devpts_root->d_inode->i_mutex);
242
243 dentry = d_alloc_name(devpts_root, s);
244 if (!IS_ERR(dentry)) {
245 d_add(dentry, inode);
241 fsnotify_create(devpts_root->d_inode, dentry); 246 fsnotify_create(devpts_root->d_inode, dentry);
242 } 247 }
243 248