Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ceph-for-5.4-rc7' of git://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
"Some late-breaking dentry handling fixes from Al and Jeff, a patch to
further restrict copy_file_range() to avoid potential data corruption
from Luis and a fix for !CONFIG_CEPH_FSCACHE kernels.

Everything but the fscache fix is marked for stable"

* tag 'ceph-for-5.4-rc7' of git://github.com/ceph/ceph-client:
ceph: return -EINVAL if given fsc mount option on kernel w/o support
ceph: don't allow copy_file_range when stripe_count != 1
ceph: don't try to handle hashed dentries in non-O_CREAT atomic_open
ceph: add missing check in d_revalidate snapdir handling
ceph: fix RCU case handling in ceph_d_revalidate()
ceph: fix use-after-free in __ceph_remove_cap()

+37 -15
+5 -5
fs/ceph/caps.c
··· 1058 1058 1059 1059 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); 1060 1060 1061 + /* remove from inode's cap rbtree, and clear auth cap */ 1062 + rb_erase(&cap->ci_node, &ci->i_caps); 1063 + if (ci->i_auth_cap == cap) 1064 + ci->i_auth_cap = NULL; 1065 + 1061 1066 /* remove from session list */ 1062 1067 spin_lock(&session->s_cap_lock); 1063 1068 if (session->s_cap_iterator == cap) { ··· 1095 1090 cap->cap_ino = ci->i_vino.ino; 1096 1091 1097 1092 spin_unlock(&session->s_cap_lock); 1098 - 1099 - /* remove from inode list */ 1100 - rb_erase(&cap->ci_node, &ci->i_caps); 1101 - if (ci->i_auth_cap == cap) 1102 - ci->i_auth_cap = NULL; 1103 1093 1104 1094 if (removed) 1105 1095 ceph_put_cap(mdsc, cap);
+8 -7
fs/ceph/dir.c
··· 1553 1553 { 1554 1554 int valid = 0; 1555 1555 struct dentry *parent; 1556 - struct inode *dir; 1556 + struct inode *dir, *inode; 1557 1557 1558 1558 if (flags & LOOKUP_RCU) { 1559 1559 parent = READ_ONCE(dentry->d_parent); 1560 1560 dir = d_inode_rcu(parent); 1561 1561 if (!dir) 1562 1562 return -ECHILD; 1563 + inode = d_inode_rcu(dentry); 1563 1564 } else { 1564 1565 parent = dget_parent(dentry); 1565 1566 dir = d_inode(parent); 1567 + inode = d_inode(dentry); 1566 1568 } 1567 1569 1568 1570 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, 1569 - dentry, d_inode(dentry), ceph_dentry(dentry)->offset); 1571 + dentry, inode, ceph_dentry(dentry)->offset); 1570 1572 1571 1573 /* always trust cached snapped dentries, snapdir dentry */ 1572 1574 if (ceph_snap(dir) != CEPH_NOSNAP) { 1573 1575 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, 1574 - dentry, d_inode(dentry)); 1576 + dentry, inode); 1575 1577 valid = 1; 1576 - } else if (d_really_is_positive(dentry) && 1577 - ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) { 1578 + } else if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 1578 1579 valid = 1; 1579 1580 } else { 1580 1581 valid = dentry_lease_is_valid(dentry, flags); 1581 1582 if (valid == -ECHILD) 1582 1583 return valid; 1583 1584 if (valid || dir_lease_is_valid(dir, dentry)) { 1584 - if (d_really_is_positive(dentry)) 1585 - valid = ceph_is_any_caps(d_inode(dentry)); 1585 + if (inode) 1586 + valid = ceph_is_any_caps(inode); 1586 1587 else 1587 1588 valid = 1; 1588 1589 }
+13 -2
fs/ceph/file.c
··· 462 462 err = ceph_security_init_secctx(dentry, mode, &as_ctx); 463 463 if (err < 0) 464 464 goto out_ctx; 465 + } else if (!d_in_lookup(dentry)) { 466 + /* If it's not being looked up, it's negative */ 467 + return -ENOENT; 465 468 } 466 469 467 470 /* do the open */ ··· 1959 1956 if (ceph_test_mount_opt(src_fsc, NOCOPYFROM)) 1960 1957 return -EOPNOTSUPP; 1961 1958 1959 + /* 1960 + * Striped file layouts require that we copy partial objects, but the 1961 + * OSD copy-from operation only supports full-object copies. Limit 1962 + * this to non-striped file layouts for now. 1963 + */ 1962 1964 if ((src_ci->i_layout.stripe_unit != dst_ci->i_layout.stripe_unit) || 1963 - (src_ci->i_layout.stripe_count != dst_ci->i_layout.stripe_count) || 1964 - (src_ci->i_layout.object_size != dst_ci->i_layout.object_size)) 1965 + (src_ci->i_layout.stripe_count != 1) || 1966 + (dst_ci->i_layout.stripe_count != 1) || 1967 + (src_ci->i_layout.object_size != dst_ci->i_layout.object_size)) { 1968 + dout("Invalid src/dst files layout\n"); 1965 1969 return -EOPNOTSUPP; 1970 + } 1966 1971 1967 1972 if (len < src_ci->i_layout.object_size) 1968 1973 return -EOPNOTSUPP; /* no remote copy will be done */
+1
fs/ceph/inode.c
··· 1434 1434 dout(" final dn %p\n", dn); 1435 1435 } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP || 1436 1436 req->r_op == CEPH_MDS_OP_MKSNAP) && 1437 + test_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags) && 1437 1438 !test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags)) { 1438 1439 struct inode *dir = req->r_parent; 1439 1440
+10 -1
fs/ceph/super.c
··· 268 268 } 269 269 break; 270 270 case Opt_fscache_uniq: 271 + #ifdef CONFIG_CEPH_FSCACHE 271 272 kfree(fsopt->fscache_uniq); 272 273 fsopt->fscache_uniq = kstrndup(argstr[0].from, 273 274 argstr[0].to-argstr[0].from, ··· 277 276 return -ENOMEM; 278 277 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; 279 278 break; 280 - /* misc */ 279 + #else 280 + pr_err("fscache support is disabled\n"); 281 + return -EINVAL; 282 + #endif 281 283 case Opt_wsize: 282 284 if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE) 283 285 return -EINVAL; ··· 357 353 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32; 358 354 break; 359 355 case Opt_fscache: 356 + #ifdef CONFIG_CEPH_FSCACHE 360 357 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; 361 358 kfree(fsopt->fscache_uniq); 362 359 fsopt->fscache_uniq = NULL; 363 360 break; 361 + #else 362 + pr_err("fscache support is disabled\n"); 363 + return -EINVAL; 364 + #endif 364 365 case Opt_nofscache: 365 366 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE; 366 367 kfree(fsopt->fscache_uniq);