diff options
author | James Morris <jmorris@namei.org> | 2011-03-07 18:55:06 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-03-07 18:55:06 -0500 |
commit | 1cc26bada9f6807814806db2f0d78792eecdac71 (patch) | |
tree | 5509b5139db04af6c13db0a580c84116a4a54039 /fs/open.c | |
parent | eae61f3c829439f8f9121b5cd48a14be04df451f (diff) | |
parent | 214d93b02c4fe93638ad268613c9702a81ed9192 (diff) |
Merge branch 'master'; commit 'v2.6.38-rc7' into next
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -223,7 +223,12 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
223 | return -EINVAL; | 223 | return -EINVAL; |
224 | 224 | ||
225 | /* Return error if mode is not supported */ | 225 | /* Return error if mode is not supported */ |
226 | if (mode && !(mode & FALLOC_FL_KEEP_SIZE)) | 226 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) |
227 | return -EOPNOTSUPP; | ||
228 | |||
229 | /* Punch hole must have keep size set */ | ||
230 | if ((mode & FALLOC_FL_PUNCH_HOLE) && | ||
231 | !(mode & FALLOC_FL_KEEP_SIZE)) | ||
227 | return -EOPNOTSUPP; | 232 | return -EOPNOTSUPP; |
228 | 233 | ||
229 | if (!(file->f_mode & FMODE_WRITE)) | 234 | if (!(file->f_mode & FMODE_WRITE)) |
@@ -250,10 +255,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
250 | if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) | 255 | if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) |
251 | return -EFBIG; | 256 | return -EFBIG; |
252 | 257 | ||
253 | if (!inode->i_op->fallocate) | 258 | if (!file->f_op->fallocate) |
254 | return -EOPNOTSUPP; | 259 | return -EOPNOTSUPP; |
255 | 260 | ||
256 | return inode->i_op->fallocate(inode, mode, offset, len); | 261 | return file->f_op->fallocate(file, mode, offset, len); |
257 | } | 262 | } |
258 | 263 | ||
259 | SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) | 264 | SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) |
@@ -786,6 +791,8 @@ struct file *nameidata_to_filp(struct nameidata *nd) | |||
786 | 791 | ||
787 | /* Pick up the filp from the open intent */ | 792 | /* Pick up the filp from the open intent */ |
788 | filp = nd->intent.open.file; | 793 | filp = nd->intent.open.file; |
794 | nd->intent.open.file = NULL; | ||
795 | |||
789 | /* Has the filesystem initialised the file for us? */ | 796 | /* Has the filesystem initialised the file for us? */ |
790 | if (filp->f_path.dentry == NULL) { | 797 | if (filp->f_path.dentry == NULL) { |
791 | path_get(&nd->path); | 798 | path_get(&nd->path); |