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-4.15-rc4' of git://github.com/ceph/ceph-client

Pull ceph fix from Ilya Dryomov:
"CephFS inode trimming fix from Zheng, marked for stable"

* tag 'ceph-for-4.15-rc4' of git://github.com/ceph/ceph-client:
ceph: drop negative child dentries before try pruning inode's alias

+38 -4
+38 -4
fs/ceph/mds_client.c
··· 1440 1440 return request_close_session(mdsc, session); 1441 1441 } 1442 1442 1443 + static bool drop_negative_children(struct dentry *dentry) 1444 + { 1445 + struct dentry *child; 1446 + bool all_negative = true; 1447 + 1448 + if (!d_is_dir(dentry)) 1449 + goto out; 1450 + 1451 + spin_lock(&dentry->d_lock); 1452 + list_for_each_entry(child, &dentry->d_subdirs, d_child) { 1453 + if (d_really_is_positive(child)) { 1454 + all_negative = false; 1455 + break; 1456 + } 1457 + } 1458 + spin_unlock(&dentry->d_lock); 1459 + 1460 + if (all_negative) 1461 + shrink_dcache_parent(dentry); 1462 + out: 1463 + return all_negative; 1464 + } 1465 + 1443 1466 /* 1444 1467 * Trim old(er) caps. 1445 1468 * ··· 1513 1490 if ((used | wanted) & ~oissued & mine) 1514 1491 goto out; /* we need these caps */ 1515 1492 1516 - session->s_trim_caps--; 1517 1493 if (oissued) { 1518 1494 /* we aren't the only cap.. just remove us */ 1519 1495 __ceph_remove_cap(cap, true); 1496 + session->s_trim_caps--; 1520 1497 } else { 1498 + struct dentry *dentry; 1521 1499 /* try dropping referring dentries */ 1522 1500 spin_unlock(&ci->i_ceph_lock); 1523 - d_prune_aliases(inode); 1524 - dout("trim_caps_cb %p cap %p pruned, count now %d\n", 1525 - inode, cap, atomic_read(&inode->i_count)); 1501 + dentry = d_find_any_alias(inode); 1502 + if (dentry && drop_negative_children(dentry)) { 1503 + int count; 1504 + dput(dentry); 1505 + d_prune_aliases(inode); 1506 + count = atomic_read(&inode->i_count); 1507 + if (count == 1) 1508 + session->s_trim_caps--; 1509 + dout("trim_caps_cb %p cap %p pruned, count now %d\n", 1510 + inode, cap, count); 1511 + } else { 1512 + dput(dentry); 1513 + } 1526 1514 return 0; 1527 1515 } 1528 1516