All of lore.kernel.org
 help / color / mirror / Atom feed
* Quota warnings somewhat broken
@ 2004-10-21 16:12 Jan Engelhardt
  2004-10-22  9:34 ` [PATCH] " Jan Kara
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Engelhardt @ 2004-10-21 16:12 UTC (permalink / raw)
  To: linux-kernel

Hello,


When a user exceeds his soft (and hard) disk quota, a warning message is
printed to current->tty. However, output is a bit offset:

$ dd if=/dev/zero of=blk bs=1024 count=100000
hda1: write failed, user block limit reached.
                                             dd: opening `blk': Disk quota exceeded

This is due to the messages in fs/dquot.c only ending in "\n" but should
probably end in "\r\n".
A patch can be found @
http://linux01.org:2222/f/hxtools/kernel/265-quota_warnfix.diff (only use the
dquot.c chunk). Despite it saying 2.6.4, it's still in 2.6.9.

Any takers?



Jan Engelhardt
-- 
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
Tel 0162.3520895 or 05502.3009.63

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Quota warnings somewhat broken
  2004-10-21 16:12 Quota warnings somewhat broken Jan Engelhardt
@ 2004-10-22  9:34 ` Jan Kara
  2004-10-22 15:07   ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kara @ 2004-10-22  9:34 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, Jan Engelhardt

  Hello,

> When a user exceeds his soft (and hard) disk quota, a warning message is
> printed to current->tty. However, output is a bit offset:
> 
> $ dd if=/dev/zero of=blk bs=1024 count=100000
> hda1: write failed, user block limit reached.
>                                              dd: opening `blk': Disk quota exceeded
> 
> This is due to the messages in fs/dquot.c only ending in "\n" but should
> probably end in "\r\n".
  Thanks for notifying. It looks like a good idea. Attached patch should apply
well to 2.6.9. Linus, please apply.

									Honza

Fix end of lines in quota messages.
Signed-off-by: Jan Kara

diff -ru linux-2.6.8.1/fs/dquot.c linux-2.6.8.1-messfix/fs/dquot.c
--- linux-2.6.8.1/fs/dquot.c	2004-10-19 12:07:08.000000000 +0200
+++ linux-2.6.8.1-messfix/fs/dquot.c	2004-10-22 11:28:26.678037906 +0200
@@ -811,22 +811,22 @@
 	tty_write_message(current->signal->tty, quotatypes[dquot->dq_type]);
 	switch (warntype) {
 		case IHARDWARN:
-			msg = " file limit reached.\n";
+			msg = " file limit reached.\r\n";
 			break;
 		case ISOFTLONGWARN:
-			msg = " file quota exceeded too long.\n";
+			msg = " file quota exceeded too long.\r\n";
 			break;
 		case ISOFTWARN:
-			msg = " file quota exceeded.\n";
+			msg = " file quota exceeded.\r\n";
 			break;
 		case BHARDWARN:
-			msg = " block limit reached.\n";
+			msg = " block limit reached.\r\n";
 			break;
 		case BSOFTLONGWARN:
-			msg = " block quota exceeded too long.\n";
+			msg = " block quota exceeded too long.\r\n";
 			break;
 		case BSOFTWARN:
-			msg = " block quota exceeded.\n";
+			msg = " block quota exceeded.\r\n";
 			break;
 	}
 	tty_write_message(current->signal->tty, msg);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Quota warnings somewhat broken
  2004-10-22 15:07   ` Linus Torvalds
@ 2004-10-22 14:25     ` Alan Cox
  2004-10-22 17:06       ` [PATCH] " Jan Engelhardt
  2004-10-22 23:35       ` Chris Wedgwood
  2004-10-25 11:15     ` Jan Kara
  1 sibling, 2 replies; 8+ messages in thread
From: Alan Cox @ 2004-10-22 14:25 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jan Kara, Linux Kernel Mailing List, Jan Engelhardt

On Gwe, 2004-10-22 at 16:07, Linus Torvalds wrote:
> Why does this code use tty_write_message() in the first place? It's a bit 
> rude to mess up the users tty without any way to disable it, isn't it? 

Tradition I guess. It's what every other quota system does, including
making annoying messes. In the new world order I guess it should be a
netlink message out to dbus and the desktop ;)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Quota warnings somewhat broken
  2004-10-22  9:34 ` [PATCH] " Jan Kara
@ 2004-10-22 15:07   ` Linus Torvalds
  2004-10-22 14:25     ` Alan Cox
  2004-10-25 11:15     ` Jan Kara
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Torvalds @ 2004-10-22 15:07 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-kernel, Jan Engelhardt



On Fri, 22 Oct 2004, Jan Kara wrote:
>
>   Thanks for notifying. It looks like a good idea. Attached patch should apply
> well to 2.6.9. Linus, please apply.

Why does this code use tty_write_message() in the first place? It's a bit 
rude to mess up the users tty without any way to disable it, isn't it? 

		Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Re: [PATCH] Quota warnings somewhat broken
  2004-10-22 14:25     ` Alan Cox
@ 2004-10-22 17:06       ` Jan Engelhardt
  2004-10-22 23:35       ` Chris Wedgwood
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Engelhardt @ 2004-10-22 17:06 UTC (permalink / raw)
  To: Alan Cox; +Cc: Linus Torvalds, Jan Kara, Linux Kernel Mailing List


>> Why does this code use tty_write_message() in the first place? It's a bit
>> rude to mess up the users tty without any way to disable it, isn't it?

See http://linux01.org:2222/f/hxtools/kernel/265-quota_warnflag.diff for a
patch that allows the administrator of the local box to change this behavior
via sysctl.

>Tradition I guess. It's what every other quota system does, including
>making annoying messes. In the new world order I guess it should be a
>netlink message out to dbus and the desktop ;)



Jan Engelhardt
-- 
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
Tel 0162.3520895 or 05502.3009.63

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Quota warnings somewhat broken
  2004-10-22 14:25     ` Alan Cox
  2004-10-22 17:06       ` [PATCH] " Jan Engelhardt
@ 2004-10-22 23:35       ` Chris Wedgwood
  1 sibling, 0 replies; 8+ messages in thread
From: Chris Wedgwood @ 2004-10-22 23:35 UTC (permalink / raw)
  To: Alan Cox
  Cc: Linus Torvalds, Jan Kara, Linux Kernel Mailing List, Jan Engelhardt

On Fri, Oct 22, 2004 at 03:25:06PM +0100, Alan Cox wrote:

> Tradition I guess. It's what every other quota system does,
> including making annoying messes. In the new world order I guess it
> should be a netlink message out to dbus and the desktop ;)

it's pretty obnoxious as-is and ideally if people want to preserve
this it should be sysctl'able off or something

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Quota warnings somewhat broken
  2004-10-22 15:07   ` Linus Torvalds
  2004-10-22 14:25     ` Alan Cox
@ 2004-10-25 11:15     ` Jan Kara
  2004-10-27 12:29       ` Jan Kara
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Kara @ 2004-10-25 11:15 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Jan Engelhardt

> On Fri, 22 Oct 2004, Jan Kara wrote:
> >
> >   Thanks for notifying. It looks like a good idea. Attached patch should apply
> > well to 2.6.9. Linus, please apply.
> 
> Why does this code use tty_write_message() in the first place? It's a bit 
> rude to mess up the users tty without any way to disable it, isn't it? 
  OK, I'll tide up a bit a patch of Jan Engelhardt <jengelh@linux01.gwdg.de>
and send it to you.

								Honza
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Quota warnings somewhat broken
  2004-10-25 11:15     ` Jan Kara
@ 2004-10-27 12:29       ` Jan Kara
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2004-10-27 12:29 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Jan Engelhardt

> > On Fri, 22 Oct 2004, Jan Kara wrote:
> > >
> > >   Thanks for notifying. It looks like a good idea. Attached patch should apply
> > > well to 2.6.9. Linus, please apply.
> > 
> > Why does this code use tty_write_message() in the first place? It's a bit 
> > rude to mess up the users tty without any way to disable it, isn't it? 
>   OK, I'll tide up a bit a patch of Jan Engelhardt <jengelh@linux01.gwdg.de>
> and send it to you.
  Here's the promised patch to allow root to turn off quota warnings
into the console. The patch is based on the one by Jan Engelhardt. Please
apply.
								Honza

Allow root to turn off quota warnings into the console.

Signed-off-by: Jan Kara <jack@suse.cz>

diff -ru linux-2.6.9/fs/dquot.c linux-2.6.9-quotawarn/fs/dquot.c
--- linux-2.6.9/fs/dquot.c	2004-10-18 23:54:39.000000000 +0200
+++ linux-2.6.9-quotawarn/fs/dquot.c	2004-10-25 15:48:56.000000000 +0200
@@ -774,8 +774,13 @@
 	clear_bit(DQ_BLKS_B, &dquot->dq_flags);
 }
 
+static int flag_print_warnings = 1;
+
 static inline int need_print_warning(struct dquot *dquot)
 {
+	if (!flag_print_warnings)
+		return 0;
+
 	switch (dquot->dq_type) {
 		case USRQUOTA:
 			return current->fsuid == dquot->dq_id;
@@ -803,6 +808,7 @@
 
 	if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
 		return;
+
 	tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
 	if (warntype == ISOFTWARN || warntype == BSOFTWARN)
 		tty_write_message(current->signal->tty, ": warning, ");
@@ -1722,6 +1728,14 @@
 		.mode		= 0444,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= FS_DQ_WARNINGS,
+		.procname	= "warnings",
+		.data		= &flag_print_warnings,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 },
 };
 
diff -ru linux-2.6.9/include/linux/sysctl.h linux-2.6.9-quotawarn/include/linux/sysctl.h
--- linux-2.6.9/include/linux/sysctl.h	2004-10-18 23:54:31.000000000 +0200
+++ linux-2.6.9-quotawarn/include/linux/sysctl.h	2004-10-25 15:43:47.000000000 +0200
@@ -662,7 +662,7 @@
 	FS_LEASES=13,	/* int: leases enabled */
 	FS_DIR_NOTIFY=14,	/* int: directory notification enabled */
 	FS_LEASE_TIME=15,	/* int: maximum time to wait for a lease break */
-	FS_DQSTATS=16,	/* disc quota usage statistics */
+	FS_DQSTATS=16,	/* disc quota usage statistics and control */
 	FS_XFS=17,	/* struct: control xfs parameters */
 	FS_AIO_NR=18,	/* current system-wide number of aio requests */
 	FS_AIO_MAX_NR=19,	/* system-wide maximum number of aio requests */
@@ -678,6 +678,7 @@
 	FS_DQ_ALLOCATED = 6,
 	FS_DQ_FREE = 7,
 	FS_DQ_SYNCS = 8,
+	FS_DQ_WARNINGS = 9,
 };
 
 /* CTL_DEBUG names: */

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-10-27 12:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 16:12 Quota warnings somewhat broken Jan Engelhardt
2004-10-22  9:34 ` [PATCH] " Jan Kara
2004-10-22 15:07   ` Linus Torvalds
2004-10-22 14:25     ` Alan Cox
2004-10-22 17:06       ` [PATCH] " Jan Engelhardt
2004-10-22 23:35       ` Chris Wedgwood
2004-10-25 11:15     ` Jan Kara
2004-10-27 12:29       ` Jan Kara

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.