summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-28 22:58:42 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-28 22:58:42 +0000
commiteed6b7c84cc33f229f6fecd884d9a22af5bec514 (patch)
tree422a7a49328c59053f4fb11805adb753523c2f2c /mm
parenta3b90e3c6976551acbac09f5aacd736a1658aaa8 (diff)
Merge with Linux 2.4.0-test5-pre6.
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 83f1586d4..7b54fc585 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -939,9 +939,10 @@ void vmtruncate(struct inode * inode, loff_t offset)
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 @@ void vmtruncate(struct inode * inode, loff_t offset)
} 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;
}