patch-2.4.0-test5 linux/mm/memory.c
Next file: linux/mm/mmap.c
Previous file: linux/mm/highmem.c
Back to the patch index
Back to the overall index
- Lines: 43
- Date:
Wed Jul 26 15:53:46 2000
- Orig file:
v2.4.0-test4/linux/mm/memory.c
- Orig date:
Fri Jul 14 12:12:16 2000
diff -u --recursive --new-file v2.4.0-test4/linux/mm/memory.c linux/mm/memory.c
@@ -939,9 +939,10 @@
unsigned long partial, pgoff;
struct vm_area_struct * mpnt;
struct address_space *mapping = inode->i_mapping;
+ unsigned long limit;
if (inode->i_size < offset)
- goto out;
+ goto do_expand;
inode->i_size = offset;
truncate_inode_pages(mapping, offset);
spin_lock(&mapping->i_shared_lock);
@@ -986,11 +987,29 @@
} while ((mpnt = mpnt->vm_next_share) != NULL);
out_unlock:
spin_unlock(&mapping->i_shared_lock);
-out:
/* this should go into ->truncate */
inode->i_size = offset;
if (inode->i_op && inode->i_op->truncate)
inode->i_op->truncate(inode);
+ return;
+
+do_expand:
+ limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+ if (limit != RLIM_INFINITY) {
+ if (inode->i_size >= limit) {
+ send_sig(SIGXFSZ, current, 0);
+ goto out;
+ }
+ if (offset > limit) {
+ send_sig(SIGXFSZ, current, 0);
+ offset = limit;
+ }
+ }
+ inode->i_size = offset;
+ if (inode->i_op && inode->i_op->truncate)
+ inode->i_op->truncate(inode);
+out:
+ return;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)