diff options
| -rw-r--r-- | fs/ceph/addr.c | 2 | ||||
| -rw-r--r-- | fs/ceph/caps.c | 10 | ||||
| -rw-r--r-- | fs/ceph/dir.c | 11 | ||||
| -rw-r--r-- | fs/ceph/export.c | 4 | ||||
| -rw-r--r-- | fs/ceph/file.c | 35 | ||||
| -rw-r--r-- | fs/ceph/inode.c | 18 | ||||
| -rw-r--r-- | fs/ceph/ioctl.c | 6 | ||||
| -rw-r--r-- | fs/ceph/locks.c | 29 | ||||
| -rw-r--r-- | fs/ceph/snap.c | 2 | ||||
| -rw-r--r-- | fs/ceph/xattr.c | 6 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 15 |
11 files changed, 80 insertions, 58 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 33da49dc3cc6..5a3953db8118 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
| @@ -453,7 +453,7 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc) | |||
| 453 | int err; | 453 | int err; |
| 454 | struct inode *inode = page->mapping->host; | 454 | struct inode *inode = page->mapping->host; |
| 455 | BUG_ON(!inode); | 455 | BUG_ON(!inode); |
| 456 | igrab(inode); | 456 | ihold(inode); |
| 457 | err = writepage_nounlock(page, wbc); | 457 | err = writepage_nounlock(page, wbc); |
| 458 | unlock_page(page); | 458 | unlock_page(page); |
| 459 | iput(inode); | 459 | iput(inode); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 1f72b00447c4..f605753c8fe9 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -2940,14 +2940,12 @@ void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) | |||
| 2940 | while (!list_empty(&mdsc->cap_dirty)) { | 2940 | while (!list_empty(&mdsc->cap_dirty)) { |
| 2941 | ci = list_first_entry(&mdsc->cap_dirty, struct ceph_inode_info, | 2941 | ci = list_first_entry(&mdsc->cap_dirty, struct ceph_inode_info, |
| 2942 | i_dirty_item); | 2942 | i_dirty_item); |
| 2943 | inode = igrab(&ci->vfs_inode); | 2943 | inode = &ci->vfs_inode; |
| 2944 | ihold(inode); | ||
| 2944 | dout("flush_dirty_caps %p\n", inode); | 2945 | dout("flush_dirty_caps %p\n", inode); |
| 2945 | spin_unlock(&mdsc->cap_dirty_lock); | 2946 | spin_unlock(&mdsc->cap_dirty_lock); |
| 2946 | if (inode) { | 2947 | ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_FLUSH, NULL); |
| 2947 | ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_FLUSH, | 2948 | iput(inode); |
| 2948 | NULL); | ||
| 2949 | iput(inode); | ||
| 2950 | } | ||
| 2951 | spin_lock(&mdsc->cap_dirty_lock); | 2949 | spin_lock(&mdsc->cap_dirty_lock); |
| 2952 | } | 2950 | } |
| 2953 | spin_unlock(&mdsc->cap_dirty_lock); | 2951 | spin_unlock(&mdsc->cap_dirty_lock); |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 33729e822bb9..ef8f08c343e8 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -308,7 +308,8 @@ more: | |||
| 308 | req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS); | 308 | req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS); |
| 309 | if (IS_ERR(req)) | 309 | if (IS_ERR(req)) |
| 310 | return PTR_ERR(req); | 310 | return PTR_ERR(req); |
| 311 | req->r_inode = igrab(inode); | 311 | req->r_inode = inode; |
| 312 | ihold(inode); | ||
| 312 | req->r_dentry = dget(filp->f_dentry); | 313 | req->r_dentry = dget(filp->f_dentry); |
| 313 | /* hints to request -> mds selection code */ | 314 | /* hints to request -> mds selection code */ |
| 314 | req->r_direct_mode = USE_AUTH_MDS; | 315 | req->r_direct_mode = USE_AUTH_MDS; |
| @@ -787,10 +788,12 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir, | |||
| 787 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; | 788 | req->r_dentry_drop = CEPH_CAP_FILE_SHARED; |
| 788 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; | 789 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; |
| 789 | err = ceph_mdsc_do_request(mdsc, dir, req); | 790 | err = ceph_mdsc_do_request(mdsc, dir, req); |
| 790 | if (err) | 791 | if (err) { |
| 791 | d_drop(dentry); | 792 | d_drop(dentry); |
| 792 | else if (!req->r_reply_info.head->is_dentry) | 793 | } else if (!req->r_reply_info.head->is_dentry) { |
| 793 | d_instantiate(dentry, igrab(old_dentry->d_inode)); | 794 | ihold(old_dentry->d_inode); |
| 795 | d_instantiate(dentry, old_dentry->d_inode); | ||
| 796 | } | ||
| 794 | ceph_mdsc_put_request(req); | 797 | ceph_mdsc_put_request(req); |
| 795 | return err; | 798 | return err; |
| 796 | } | 799 | } |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index a610d3d67488..f67b687550de 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
| @@ -109,7 +109,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, | |||
| 109 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 109 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
| 110 | inode = req->r_target_inode; | 110 | inode = req->r_target_inode; |
| 111 | if (inode) | 111 | if (inode) |
| 112 | igrab(inode); | 112 | ihold(inode); |
| 113 | ceph_mdsc_put_request(req); | 113 | ceph_mdsc_put_request(req); |
| 114 | if (!inode) | 114 | if (!inode) |
| 115 | return ERR_PTR(-ESTALE); | 115 | return ERR_PTR(-ESTALE); |
| @@ -167,7 +167,7 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb, | |||
| 167 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 167 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
| 168 | inode = req->r_target_inode; | 168 | inode = req->r_target_inode; |
| 169 | if (inode) | 169 | if (inode) |
| 170 | igrab(inode); | 170 | ihold(inode); |
| 171 | ceph_mdsc_put_request(req); | 171 | ceph_mdsc_put_request(req); |
| 172 | if (!inode) | 172 | if (!inode) |
| 173 | return ERR_PTR(err ? err : -ESTALE); | 173 | return ERR_PTR(err ? err : -ESTALE); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 203252d88d9f..9542f07d0b93 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
| @@ -191,7 +191,8 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 191 | err = PTR_ERR(req); | 191 | err = PTR_ERR(req); |
| 192 | goto out; | 192 | goto out; |
| 193 | } | 193 | } |
| 194 | req->r_inode = igrab(inode); | 194 | req->r_inode = inode; |
| 195 | ihold(inode); | ||
| 195 | req->r_num_caps = 1; | 196 | req->r_num_caps = 1; |
| 196 | err = ceph_mdsc_do_request(mdsc, parent_inode, req); | 197 | err = ceph_mdsc_do_request(mdsc, parent_inode, req); |
| 197 | if (!err) | 198 | if (!err) |
| @@ -282,7 +283,7 @@ int ceph_release(struct inode *inode, struct file *file) | |||
| 282 | static int striped_read(struct inode *inode, | 283 | static int striped_read(struct inode *inode, |
| 283 | u64 off, u64 len, | 284 | u64 off, u64 len, |
| 284 | struct page **pages, int num_pages, | 285 | struct page **pages, int num_pages, |
| 285 | int *checkeof, bool align_to_pages, | 286 | int *checkeof, bool o_direct, |
| 286 | unsigned long buf_align) | 287 | unsigned long buf_align) |
| 287 | { | 288 | { |
| 288 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 289 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
| @@ -307,7 +308,7 @@ static int striped_read(struct inode *inode, | |||
| 307 | io_align = off & ~PAGE_MASK; | 308 | io_align = off & ~PAGE_MASK; |
| 308 | 309 | ||
| 309 | more: | 310 | more: |
| 310 | if (align_to_pages) | 311 | if (o_direct) |
| 311 | page_align = (pos - io_align + buf_align) & ~PAGE_MASK; | 312 | page_align = (pos - io_align + buf_align) & ~PAGE_MASK; |
| 312 | else | 313 | else |
| 313 | page_align = pos & ~PAGE_MASK; | 314 | page_align = pos & ~PAGE_MASK; |
| @@ -317,10 +318,10 @@ more: | |||
| 317 | ci->i_truncate_seq, | 318 | ci->i_truncate_seq, |
| 318 | ci->i_truncate_size, | 319 | ci->i_truncate_size, |
| 319 | page_pos, pages_left, page_align); | 320 | page_pos, pages_left, page_align); |
| 320 | hit_stripe = this_len < left; | ||
| 321 | was_short = ret >= 0 && ret < this_len; | ||
| 322 | if (ret == -ENOENT) | 321 | if (ret == -ENOENT) |
| 323 | ret = 0; | 322 | ret = 0; |
| 323 | hit_stripe = this_len < left; | ||
| 324 | was_short = ret >= 0 && ret < this_len; | ||
| 324 | dout("striped_read %llu~%u (read %u) got %d%s%s\n", pos, left, read, | 325 | dout("striped_read %llu~%u (read %u) got %d%s%s\n", pos, left, read, |
| 325 | ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : ""); | 326 | ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : ""); |
| 326 | 327 | ||
| @@ -345,20 +346,22 @@ more: | |||
| 345 | } | 346 | } |
| 346 | 347 | ||
| 347 | if (was_short) { | 348 | if (was_short) { |
| 348 | /* was original extent fully inside i_size? */ | 349 | /* did we bounce off eof? */ |
| 349 | if (pos + left <= inode->i_size) { | 350 | if (pos + left > inode->i_size) |
| 350 | dout("zero tail\n"); | 351 | *checkeof = 1; |
| 351 | ceph_zero_page_vector_range(page_off + read, len - read, | 352 | |
| 353 | /* zero trailing bytes (inside i_size) */ | ||
| 354 | if (left > 0 && pos < inode->i_size) { | ||
| 355 | if (pos + left > inode->i_size) | ||
| 356 | left = inode->i_size - pos; | ||
| 357 | |||
| 358 | dout("zero tail %d\n", left); | ||
| 359 | ceph_zero_page_vector_range(page_off + read, left, | ||
| 352 | pages); | 360 | pages); |
| 353 | read = len; | 361 | read += left; |
| 354 | goto out; | ||
| 355 | } | 362 | } |
| 356 | |||
| 357 | /* check i_size */ | ||
| 358 | *checkeof = 1; | ||
| 359 | } | 363 | } |
| 360 | 364 | ||
| 361 | out: | ||
| 362 | if (ret >= 0) | 365 | if (ret >= 0) |
| 363 | ret = read; | 366 | ret = read; |
| 364 | dout("striped_read returns %d\n", ret); | 367 | dout("striped_read returns %d\n", ret); |
| @@ -658,7 +661,7 @@ out: | |||
| 658 | 661 | ||
| 659 | /* hit EOF or hole? */ | 662 | /* hit EOF or hole? */ |
| 660 | if (statret == 0 && *ppos < inode->i_size) { | 663 | if (statret == 0 && *ppos < inode->i_size) { |
| 661 | dout("aio_read sync_read hit hole, reading more\n"); | ||
