lkml.org 
[lkml]   [2001]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] s_maxbytes handling
If ->f_pos is positioned exactly at sb->s_maxbytes, a non-zero-length
write to the file doesn't write anything, and write() returns zero.

Consequently applications which try to append to a file which
is s_maxbytes in length hang up, because write() just keeps
on returning zero.

We need to return -EFBIG if ->f_pos is at s_maxbytes and
the length is non-zero.

--- linux-2.4.5-pre4/mm/filemap.c Mon May 21 20:03:03 2001
+++ linux-akpm/mm/filemap.c Tue May 22 22:34:41 2001
@@ -2571,11 +2571,13 @@
* Linus frestrict idea will clean these up nicely..
*/

- if (pos > inode->i_sb->s_maxbytes)
- {
- send_sig(SIGXFSZ, current, 0);
- err = -EFBIG;
- goto out;
+ if (pos >= inode->i_sb->s_maxbytes) {
+ if (count || pos > inode->i_sb->s_maxbytes) {
+ send_sig(SIGXFSZ, current, 0);
+ err = -EFBIG;
+ goto out;
+ }
+ /* zero-length writes at ->s_maxbytes are OK */
}

if (pos + count > inode->i_sb->s_maxbytes)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.061 / U:6.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site