hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/fs/ceph/caps.c
....@@ -1636,6 +1636,7 @@
16361636 struct inode *inode = &ci->vfs_inode;
16371637 struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
16381638 struct ceph_mds_session *session = NULL;
1639
+ bool need_put = false;
16391640 int mds;
16401641
16411642 dout("ceph_flush_snaps %p\n", inode);
....@@ -1687,8 +1688,13 @@
16871688 }
16881689 /* we flushed them all; remove this inode from the queue */
16891690 spin_lock(&mdsc->snap_flush_lock);
1691
+ if (!list_empty(&ci->i_snap_flush_item))
1692
+ need_put = true;
16901693 list_del_init(&ci->i_snap_flush_item);
16911694 spin_unlock(&mdsc->snap_flush_lock);
1695
+
1696
+ if (need_put)
1697
+ iput(inode);
16921698 }
16931699
16941700 /*
....@@ -2957,7 +2963,7 @@
29572963
29582964 while (true) {
29592965 flags &= CEPH_FILE_MODE_MASK;
2960
- if (atomic_read(&fi->num_locks))
2966
+ if (vfs_inode_has_locks(inode))
29612967 flags |= CHECK_FILELOCK;
29622968 _got = 0;
29632969 ret = try_get_cap_refs(inode, need, want, endoff,
....@@ -3568,6 +3574,15 @@
35683574 }
35693575 BUG_ON(cap->issued & ~cap->implemented);
35703576
3577
+ /* don't let check_caps skip sending a response to MDS for revoke msgs */
3578
+ if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {
3579
+ cap->mds_wanted = 0;
3580
+ if (cap == ci->i_auth_cap)
3581
+ check_caps = 1; /* check auth cap only */
3582
+ else
3583
+ check_caps = 2; /* check all caps */
3584
+ }
3585
+
35713586 if (extra_info->inline_version > 0 &&
35723587 extra_info->inline_version >= ci->i_inline_version) {
35733588 ci->i_inline_version = extra_info->inline_version;