diff options
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/acl.c | 14 | ||||
-rw-r--r-- | fs/ceph/caps.c | 2 | ||||
-rw-r--r-- | fs/ceph/file.c | 24 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 16 | ||||
-rw-r--r-- | fs/ceph/xattr.c | 4 |
5 files changed, 43 insertions, 17 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 469f2e8657e8..cebf2ebefb55 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c | |||
@@ -172,14 +172,24 @@ out: | |||
172 | int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) | 172 | int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) |
173 | { | 173 | { |
174 | struct posix_acl *default_acl, *acl; | 174 | struct posix_acl *default_acl, *acl; |
175 | umode_t new_mode = inode->i_mode; | ||
175 | int error; | 176 | int error; |
176 | 177 | ||
177 | error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); | 178 | error = posix_acl_create(dir, &new_mode, &default_acl, &acl); |
178 | if (error) | 179 | if (error) |
179 | return error; | 180 | return error; |
180 | 181 | ||
181 | if (!default_acl && !acl) | 182 | if (!default_acl && !acl) { |
182 | cache_no_acl(inode); | 183 | cache_no_acl(inode); |
184 | if (new_mode != inode->i_mode) { | ||
185 | struct iattr newattrs = { | ||
186 | .ia_mode = new_mode, | ||
187 | .ia_valid = ATTR_MODE, | ||
188 | }; | ||
189 | error = ceph_setattr(dentry, &newattrs); | ||
190 | } | ||
191 | return error; | ||
192 | } | ||
183 | 193 | ||
184 | if (default_acl) { | 194 | if (default_acl) { |
185 | error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); | 195 | error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 1fde164b74b5..6d1cd45dca89 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -3277,7 +3277,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
3277 | rel->ino = cpu_to_le64(ceph_ino(inode)); | 3277 | rel->ino = cpu_to_le64(ceph_ino(inode)); |
3278 | rel->cap_id = cpu_to_le64(cap->cap_id); | 3278 | rel->cap_id = cpu_to_le64(cap->cap_id); |
3279 | rel->seq = cpu_to_le32(cap->seq); | 3279 | rel->seq = cpu_to_le32(cap->seq); |
3280 | rel->issue_seq = cpu_to_le32(cap->issue_seq), | 3280 | rel->issue_seq = cpu_to_le32(cap->issue_seq); |
3281 | rel->mseq = cpu_to_le32(cap->mseq); | 3281 | rel->mseq = cpu_to_le32(cap->mseq); |
3282 | rel->caps = cpu_to_le32(cap->implemented); | 3282 | rel->caps = cpu_to_le32(cap->implemented); |
3283 | rel->wanted = cpu_to_le32(cap->mds_wanted); | 3283 | rel->wanted = cpu_to_le32(cap->mds_wanted); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 302085100c28..2eb02f80a0ab 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -423,6 +423,9 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, | |||
423 | dout("sync_read on file %p %llu~%u %s\n", file, off, | 423 | dout("sync_read on file %p %llu~%u %s\n", file, off, |
424 | (unsigned)len, | 424 | (unsigned)len, |
425 | (file->f_flags & O_DIRECT) ? "O_DIRECT" : ""); | 425 | (file->f_flags & O_DIRECT) ? "O_DIRECT" : ""); |
426 | |||
427 | if (!len) | ||
428 | return 0; | ||
426 | /* | 429 | /* |
427 | * flush any page cache pages in this range. this | 430 | * flush any page cache pages in this range. this |
428 | * will make concurrent normal and sync io slow, | 431 | * will make concurrent normal and sync io slow, |
@@ -470,8 +473,11 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, | |||
470 | size_t left = ret; | 473 | size_t left = ret; |
471 | 474 | ||
472 | while (left) { | 475 | while (left) { |
473 | int copy = min_t(size_t, PAGE_SIZE, left); | 476 | size_t page_off = off & ~PAGE_MASK; |
474 | l = copy_page_to_iter(pages[k++], 0, copy, i); | 477 | size_t copy = min_t(size_t, |
478 | PAGE_SIZE - page_off, left); | ||
479 | l = copy_page_to_iter(pages[k++], page_off, | ||
480 | copy, i); | ||
475 | off += l; | 481 | off += l; |
476 | left -= l; | 482 | left -= l; |
477 | if (l < copy) | 483 | if (l < copy) |
@@ -531,7 +537,7 @@ static void ceph_sync_write_unsafe(struct ceph_osd_request *req, bool unsafe) | |||
531 | * objects, rollback on failure, etc.) | 537 | * objects, rollback on failure, etc.) |
532 | */ | 538 | */ |
533 | static ssize_t | 539 | static ssize_t |
534 | ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from) | 540 | ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos) |
535 | { | 541 | { |
536 | struct file *file = iocb->ki_filp; | 542 | struct file *file = iocb->ki_filp; |
537 | struct inode *inode = file_inode(file); | 543 | struct inode *inode = file_inode(file); |
@@ -547,7 +553,6 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from) | |||
547 | int check_caps = 0; | 553 | int check_caps = 0; |
548 | int ret; | 554 | int ret; |
549 | struct timespec mtime = CURRENT_TIME; | 555 | struct timespec mtime = CURRENT_TIME; |
550 | loff_t pos = iocb->ki_pos; | ||
551 | size_t count = iov_iter_count(from); | 556 | size_t count = iov_iter_count(from); |
552 | 557 | ||
553 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) | 558 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) |
@@ -646,7 +651,8 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from) | |||
646 | * correct atomic write, we should e.g. take write locks on all | 651 | * correct atomic write, we should e.g. take write locks on all |
647 | * objects, rollback on failure, etc.) | 652 | * objects, rollback on failure, etc.) |
648 | */ | 653 | */ |
649 | static ssize_t ceph_sync_write(struct kiocb *iocb, struct iov_iter *from) | 654 | static ssize_t |
655 | ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos) | ||
650 | { | 656 | { |
651 | struct file *file = iocb->ki_filp; | 657 | struct file *file = iocb->ki_filp; |
652 | struct inode *inode = file_inode(file); | 658 | struct inode *inode = file_inode(file); |
@@ -663,7 +669,6 @@ static ssize_t ceph_sync_write(struct kiocb *iocb, struct iov_iter *from) | |||
663 | int check_caps = 0; | 669 | int check_caps = 0; |
664 | int ret; | 670 | int ret; |
665 | struct timespec mtime = CURRENT_TIME; | 671 | struct timespec mtime = CURRENT_TIME; |
666 | loff_t pos = iocb->ki_pos; | ||
667 | size_t count = iov_iter_count(from); | 672 | size_t count = iov_iter_count(from); |
668 | 673 | ||
669 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) | 674 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) |
@@ -918,9 +923,9 @@ retry_snap: | |||
918 | /* we might need to revert back to that point */ | 923 | /* we might need to revert back to that point */ |
919 | data = *from; | 924 | data = *from; |
920 | if (file->f_flags & O_DIRECT) | 925 | if (file->f_flags & O_DIRECT) |
921 | written = ceph_sync_direct_write(iocb, &data); | 926 | written = ceph_sync_direct_write(iocb, &data, pos); |
922 | else | 927 | else |
923 | written = ceph_sync_write(iocb, &data); | 928 | written = ceph_sync_write(iocb, &data, pos); |
924 | if (written == -EOLDSNAPC) { | 929 | if (written == -EOLDSNAPC) { |
925 | dout("aio_write %p %llx.%llx %llu~%u" | 930 | dout("aio_write %p %llx.%llx %llu~%u" |
926 | "got EOLDSNAPC, retrying\n", | 931 | "got EOLDSNAPC, retrying\n", |
@@ -1177,6 +1182,9 @@ static long ceph_fallocate(struct file *file, int mode, | |||
1177 | loff_t endoff = 0; | 1182 | loff_t endoff = 0; |
1178 | loff_t size; | 1183 | loff_t size; |
1179 | 1184 | ||
1185 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) | ||
1186 | return -EOPNOTSUPP; | ||
1187 | |||
1180 | if (!S_ISREG(inode->i_mode)) | 1188 | if (!S_ISREG(inode->i_mode)) |
1181 | return -EOPNOTSUPP; | 1189 | return -EOPNOTSUPP; |
1182 | 1190 | ||
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 92a2548278fc..bad07c09f91e 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1904,6 +1904,7 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc, | |||
1904 | req->r_tid, ceph_mds_op_name(req->r_op), req->r_attempts); | 1904 | req->r_tid, ceph_mds_op_name(req->r_op), req->r_attempts); |
1905 | 1905 | ||
1906 | if (req->r_got_unsafe) { | 1906 | if (req->r_got_unsafe) { |
1907 | void *p; | ||
1907 | /* | 1908 | /* |
1908 | * Replay. Do not regenerate message (and rebuild | 1909 | * Replay. Do not regenerate message (and rebuild |
1909 | * paths, etc.); just use the original message. | 1910 | * paths, etc.); just use the original message. |
@@ -1924,8 +1925,13 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc, | |||
1924 | 1925 | ||
1925 | /* remove cap/dentry releases from message */ | 1926 | /* remove cap/dentry releases from message */ |
1926 | rhead->num_releases = 0; | 1927 | rhead->num_releases = 0; |
1927 | msg->hdr.front_len = cpu_to_le32(req->r_request_release_offset); | 1928 | |
1928 | msg->front.iov_len = req->r_request_release_offset; | 1929 | /* time stamp */ |
1930 | p = msg->front.iov_base + req->r_request_release_offset; | ||
1931 | ceph_encode_copy(&p, &req->r_stamp, sizeof(req->r_stamp)); | ||
1932 | |||
1933 | msg->front.iov_len = p - msg->front.iov_base; | ||
1934 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); | ||
1929 | return 0; | 1935 | return 0; |
1930 | } | 1936 | } |
1931 | 1937 | ||
@@ -2061,11 +2067,12 @@ static void __wake_requests(struct ceph_mds_client *mdsc, | |||
2061 | static void kick_requests(struct ceph_mds_client *mdsc, int mds) | 2067 | static void kick_requests(struct ceph_mds_client *mdsc, int mds) |
2062 | { | 2068 | { |
2063 | struct ceph_mds_request *req; | 2069 | struct ceph_mds_request *req; |
2064 | struct rb_node *p; | 2070 | struct rb_node *p = rb_first(&mdsc->request_tree); |
2065 | 2071 | ||
2066 | dout("kick_requests mds%d\n", mds); | 2072 | dout("kick_requests mds%d\n", mds); |
2067 | for (p = rb_first(&mdsc->request_tree); p; p = rb_next(p)) { | 2073 | while (p) { |
2068 | req = rb_entry(p, struct ceph_mds_request, r_node); | 2074 | req = rb_entry(p, struct ceph_mds_request, r_node); |
2075 | p = rb_next(p); | ||
2069 | if (req->r_got_unsafe) | 2076 | if (req->r_got_unsafe) |
2070 | continue; | 2077 | continue; |
2071 | if (req->r_session && | 2078 | if (req->r_session && |
@@ -2248,6 +2255,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
2248 | */ | 2255 | */ |
2249 | if (result == -ESTALE) { | 2256 | if (result == -ESTALE) { |
2250 | dout("got ESTALE on request %llu", req->r_tid); | 2257 | dout("got ESTALE on request %llu", req->r_tid); |
2258 | req->r_resend_mds = -1; | ||
2251 | if (req->r_direct_mode != USE_AUTH_MDS) { | 2259 | if (req->r_direct_mode != USE_AUTH_MDS) { |
2252 | dout("not using auth, setting for that now"); | 2260 | dout("not using auth, setting for that now"); |
2253 | req->r_direct_mode = USE_AUTH_MDS; | 2261 | req->r_direct_mode = USE_AUTH_MDS; |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index c9c2b887381e..12f58d22e017 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -592,12 +592,12 @@ start: | |||
592 | xattr_version = ci->i_xattrs.version; | 592 | xattr_version = ci->i_xattrs.version; |
593 | spin_unlock(&ci->i_ceph_lock); | 593 | spin_unlock(&ci->i_ceph_lock); |
594 | 594 | ||
595 | xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *), | 595 | xattrs = kcalloc(numattr, sizeof(struct ceph_inode_xattr *), |
596 | GFP_NOFS); | 596 | GFP_NOFS); |
597 | err = -ENOMEM; | 597 | err = -ENOMEM; |
598 | if (!xattrs) | 598 | if (!xattrs) |
599 | goto bad_lock; | 599 | goto bad_lock; |
600 | memset(xattrs, 0, numattr*sizeof(struct ceph_xattr *)); | 600 | |
601 | for (i = 0; i < numattr; i++) { | 601 | for (i = 0; i < numattr; i++) { |
602 | xattrs[i] = kmalloc(sizeof(struct ceph_inode_xattr), | 602 | xattrs[i] = kmalloc(sizeof(struct ceph_inode_xattr), |
603 | GFP_NOFS); | 603 | GFP_NOFS); |