(Please cc: me, I'm not subscribed.)
> I don't think this is the right way to do it. It should fail the open
> of /dev/ptmx, not when trying to access the slave.
>
> -hpa
This is exactly what will happen:
open("typescript", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
ioctl(0, TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=484, ws_ypixel=316}) = 0
open("/dev/ptmx", O_RDWR) = -1 EDQUOT (Disk quota exceeded)
write(2, "openpty failed\n", 15openpty failed
) = 15
kill(0, SIGTERM <unfinished ...>
BTW, the patch I sent earlier missed a part, sorry. For some reason, devices
weren't counted in inode quotas, which is inconsistent with quotacheck.
-Topi
diff -ru linux-2.2.15.orig/fs/devpts/inode.c linux-2.2.15/fs/devpts/inode.c
--- linux-2.2.15.orig/fs/devpts/inode.c Fri Aug 21 04:33:50 1998
+++ linux-2.2.15/fs/devpts/inode.c Sun Jun 4 23:22:59 2000
@@ -21,6 +21,7 @@
#include <linux/malloc.h>
#include <linux/stat.h>
#include <linux/tty.h>
+#include <linux/quotaops.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
@@ -111,6 +112,11 @@
if (*value)
return 1;
}
+ else if (!strcmp(this_char,"usrquota")
+ || !strcmp(this_char,"grpquota")
+ || !strcmp(this_char,"rsquash")) {
+ ;
+ }
else
return 1;
}
@@ -302,7 +308,7 @@
NULL
};
-void devpts_pty_new(int number, kdev_t device)
+int devpts_pty_new(int number, kdev_t device)
{
struct super_block *sb;
struct devpts_sb_info *sbi;
@@ -324,8 +330,17 @@
inode->i_rdev = device;
inode->i_nlink++;
sbi->inodes[number] = inode;
+
+ if (DQUOT_ALLOC_INODE(sb, inode)) {
+ if (sb->dq_op)
+ sb->dq_op->drop(inode);
+ inode->i_nlink = 0;
+ iput(inode);
+ return -EDQUOT;
+ }
}
}
+ return 0;
}
void devpts_pty_kill(int number)
@@ -340,6 +355,8 @@
inode = sbi->inodes[number];
if ( inode ) {
+ DQUOT_FREE_INODE(sb, inode);
+ DQUOT_DROP(inode);
sbi->inodes[number] = NULL;
inode->i_nlink--;
iput(inode);
diff -ru linux-2.2.15.orig/fs/dquot.c linux-2.2.15/fs/dquot.c
--- linux-2.2.15.orig/fs/dquot.c Wed Jun 7 21:27:18 2000
+++ linux-2.2.15/fs/dquot.c Wed Jun 7 21:17:19 2000
@@ -667,8 +667,10 @@
{
int cnt;
+#if 0
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)))
return 0;
+#endif
if (is_quotafile(inode))
return 0;
if (type != -1)
@@ -1082,9 +1084,11 @@
unsigned int id = 0;
short cnt;
+#if 0
if (S_ISREG(inode->i_mode) ||
S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)) {
+#endif
/* We don't want to have quotas on quota files - nasty deadlocks possible */
if (is_quotafile(inode))
return;
@@ -1115,7 +1119,9 @@
inode->i_flags |= S_QUOTA;
}
}
+#if 0
}
+#endif
}
/*
diff -ru linux-2.2.15.orig/drivers/char/tty_io.c linux-2.2.15/drivers/char/tty_
io.c
--- linux-2.2.15.orig/drivers/char/tty_io.c Wed Jun 7 21:05:33 2000
+++ linux-2.2.15/drivers/char/tty_io.c Sun Jun 4 23:41:37 2000
@@ -1331,7 +1331,12 @@
ptmx_found:
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
minor -= driver->minor_start;
- devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->other->
major, minor + driver->other->minor_start));
+ retval = devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->
other->major, minor + driver->other->minor_start));
+ if (retval) {
+ filp->private_data = tty;
+ release_dev(filp);
+ return retval; /* quota exceeded */
+ }
tty_register_devfs(&pts_driver[major], 0,
pts_driver[major].minor_start + minor);
noctty = 1;
diff -ru linux-2.2.15.orig/include/linux/devpts_fs.h
linux-2.2.15/include/linux/devpts_fs.h
--- linux-2.2.15.orig/include/linux/devpts_fs.h Tue May 11 20:35:45 1999
+++ linux-2.2.15/include/linux/devpts_fs.h Sun Jun 4 23:32:26 2000
@@ -25,14 +25,14 @@
#ifdef CONFIG_DEVPTS_FS
-void devpts_pty_new(int, kdev_t);
+int devpts_pty_new(int, kdev_t);
void devpts_pty_kill(int);
#define unix98_max_ptys NR_PTYS * UNIX98_NR_MAJORS;
#elif defined(CONFIG_DEVPTS_FS_MODULE)
#ifdef BUILDING_PTY_C
-void (*devpts_upcall_new)(int,kdev_t) = NULL;
+int (*devpts_upcall_new)(int,kdev_t) = NULL;
void (*devpts_upcall_kill)(int) = NULL;
unsigned int unix98_max_ptys = NR_PTYS * UNIX98_NR_MAJORS;
@@ -46,7 +46,7 @@
#endif
#ifndef BUILDING_DEVPTS
-extern inline void
+extern inline int
devpts_pty_new(int line, kdev_t device)
{
if ( devpts_upcall_new )
@@ -63,8 +63,8 @@
#else /* No /dev/pts filesystem at all */
-extern inline void
-devpts_pty_new(int line, kdev_t device) { }
+extern inline int
+devpts_pty_new(int line, kdev_t device) { return 0; }
extern inline void
devpts_pty_kill(int line) { }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:29 EST