Commit 48f7ee5a authored by Linus Torvalds's avatar Linus Torvalds

Add 'f_maxcount' to allow filesystems to set a per-file maximum IO size.

parent b0217ce8
......@@ -85,6 +85,7 @@ static int old_max;
rwlock_init(&f->f_owner.lock);
/* f->f_version: 0 */
INIT_LIST_HEAD(&f->f_list);
f->f_maxcount = INT_MAX;
return f;
}
}
......
......@@ -185,8 +185,12 @@ asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode;
if (count > file->f_maxcount)
return -EINVAL;
inode = file->f_dentry->d_inode;
if (inode->i_flock && MANDATORY_LOCK(inode))
return locks_mandatory_area(read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, inode, file, *ppos, count);
return 0;
......
......@@ -586,6 +586,7 @@ struct file {
unsigned int f_uid, f_gid;
struct file_ra_state f_ra;
size_t f_maxcount;
unsigned long f_version;
void *f_security;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment