diff options
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/file.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 761841903160..3f0b9339d823 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -941,9 +941,9 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
941 | struct ceph_inode_info *ci = ceph_inode(inode); | 941 | struct ceph_inode_info *ci = ceph_inode(inode); |
942 | struct ceph_osd_client *osdc = | 942 | struct ceph_osd_client *osdc = |
943 | &ceph_sb_to_client(inode->i_sb)->client->osdc; | 943 | &ceph_sb_to_client(inode->i_sb)->client->osdc; |
944 | ssize_t count = iov_iter_count(from), written = 0; | 944 | ssize_t count, written = 0; |
945 | int err, want, got; | 945 | int err, want, got; |
946 | loff_t pos = iocb->ki_pos; | 946 | loff_t pos; |
947 | 947 | ||
948 | if (ceph_snap(inode) != CEPH_NOSNAP) | 948 | if (ceph_snap(inode) != CEPH_NOSNAP) |
949 | return -EROFS; | 949 | return -EROFS; |
@@ -953,14 +953,12 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
953 | /* We can write back this queue in page reclaim */ | 953 | /* We can write back this queue in page reclaim */ |
954 | current->backing_dev_info = inode_to_bdi(inode); | 954 | current->backing_dev_info = inode_to_bdi(inode); |
955 | 955 | ||
956 | err = generic_write_checks(file, &pos, &count); | 956 | err = generic_write_checks(iocb, from); |
957 | if (err) | 957 | if (err <= 0) |
958 | goto out; | ||
959 | |||
960 | if (count == 0) | ||
961 | goto out; | 958 | goto out; |
962 | iov_iter_truncate(from, count); | ||
963 | 959 | ||
960 | pos = iocb->ki_pos; | ||
961 | count = iov_iter_count(from); | ||
964 | err = file_remove_suid(file); | 962 | err = file_remove_suid(file); |
965 | if (err) | 963 | if (err) |
966 | goto out; | 964 | goto out; |