[PATCH] Re: setrlimit and RLIM_INFINITY causing fsck failure, 2.4.18

Peter Hartley
2002-03-20T10:36:25Z

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

AC wrote:
> Test it and see 8)

OK, did do. Patch attached. The occurrence in filemap.c was the one killing
fsck, but I went looking for other occurrences of SIGXFS and made sure they
did the right thing too.

This doesn't address any other wonkiness of rlimit, it just stops it
applying to block devices.

Peter

[-- Attachment #2: sigxfs-vs-blkdev.patch --]
[-- Type: application/octet-stream, Size: 1737 bytes --]

diff -u3 -r linux/fs/buffer.c linux.pdh/fs/buffer.c
--- linux/fs/buffer.c Mon Feb 25 19:38:08 2002
+++ linux.pdh/fs/buffer.c Tue Mar 19 19:23:43 2002
@@ -1834,7 +1834,7 @@

err = -EFBIG;
limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
- if (limit != RLIM_INFINITY && size > (loff_t)limit) {
+ if (limit != RLIM_INFINITY && size > (loff_t)limit && !S_ISBLK(inode->i_mode)) {
send_sig(SIGXFSZ, current, 0);
goto out;
}
diff -u3 -r linux/mm/filemap.c linux.pdh/mm/filemap.c
--- linux/mm/filemap.c Mon Feb 25 19:38:13 2002
+++ linux.pdh/mm/filemap.c Tue Mar 19 19:21:17 2002
@@ -2885,8 +2885,8 @@
* Check whether we've reached the file size limit.
*/
err = -EFBIG;
-
- if (limit != RLIM_INFINITY) {
+
+ if (limit != RLIM_INFINITY && !S_ISBLK(inode->i_mode)) {
if (pos >= limit) {
send_sig(SIGXFSZ, current, 0);
goto out;
diff -u3 -r linux/mm/memory.c linux.pdh/mm/memory.c
--- linux/mm/memory.c Mon Feb 25 19:38:13 2002
+++ linux.pdh/mm/memory.c Tue Mar 19 19:22:45 2002
@@ -1059,7 +1059,7 @@

do_expand:
limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
- if (limit != RLIM_INFINITY && offset > limit)
+ if (limit != RLIM_INFINITY && offset > limit && !S_ISBLK(inode->i_mode))
goto out_sig;
if (offset > inode->i_sb->s_maxbytes)
goto out;
diff -u3 -r linux/mm/shmem.c linux.pdh/mm/shmem.c
--- linux/mm/shmem.c Mon Feb 25 19:38:14 2002
+++ linux.pdh/mm/shmem.c Tue Mar 19 19:23:17 2002
@@ -780,7 +780,7 @@
* Check whether we've reached the file size limit.
*/
err = -EFBIG;
- if (limit != RLIM_INFINITY) {
+ if (limit != RLIM_INFINITY && !S_ISBLK(inode->i_mode)) {
if (pos >= limit) {
send_sig(SIGXFSZ, current, 0);
goto out;