diff options
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 4698a5c553dc..0d0eae05598f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -226,7 +226,7 @@ struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry, | |||
226 | struct inode *parent_inode = get_dentry_parent_inode(file->f_dentry); | 226 | struct inode *parent_inode = get_dentry_parent_inode(file->f_dentry); |
227 | struct ceph_mds_request *req; | 227 | struct ceph_mds_request *req; |
228 | int err; | 228 | int err; |
229 | int flags = nd->intent.open.flags - 1; /* silly vfs! */ | 229 | int flags = nd->intent.open.flags; |
230 | 230 | ||
231 | dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", | 231 | dout("ceph_lookup_open dentry %p '%.*s' flags %d mode 0%o\n", |
232 | dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); | 232 | dentry, dentry->d_name.len, dentry->d_name.name, flags, mode); |
@@ -768,13 +768,16 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
768 | 768 | ||
769 | mutex_lock(&inode->i_mutex); | 769 | mutex_lock(&inode->i_mutex); |
770 | __ceph_do_pending_vmtruncate(inode); | 770 | __ceph_do_pending_vmtruncate(inode); |
771 | switch (origin) { | 771 | if (origin != SEEK_CUR || origin != SEEK_SET) { |
772 | case SEEK_END: | ||
773 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); | 772 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); |
774 | if (ret < 0) { | 773 | if (ret < 0) { |
775 | offset = ret; | 774 | offset = ret; |
776 | goto out; | 775 | goto out; |
777 | } | 776 | } |
777 | } | ||
778 | |||
779 | switch (origin) { | ||
780 | case SEEK_END: | ||
778 | offset += inode->i_size; | 781 | offset += inode->i_size; |
779 | break; | 782 | break; |
780 | case SEEK_CUR: | 783 | case SEEK_CUR: |
@@ -790,6 +793,19 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
790 | } | 793 | } |
791 | offset += file->f_pos; | 794 | offset += file->f_pos; |
792 | break; | 795 | break; |
796 | case SEEK_DATA: | ||
797 | if (offset >= inode->i_size) { | ||
798 | ret = -ENXIO; | ||
799 | goto out; | ||
800 | } | ||
801 | break; | ||
802 | case SEEK_HOLE: | ||
803 | if (offset >= inode->i_size) { | ||
804 | ret = -ENXIO; | ||
805 | goto out; | ||
806 | } | ||
807 | offset = inode->i_size; | ||
808 | break; | ||
793 | } | 809 | } |
794 | 810 | ||
795 | if (offset < 0 || offset > inode->i_sb->s_maxbytes) { | 811 | if (offset < 0 || offset > inode->i_sb->s_maxbytes) { |