Skip to content

Commit 600b4a2

Browse files
committed
ceph: switch to use cap_delay_lock for the unlink delay list
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4 commit-author Xiubo Li <xiubli@redhat.com> commit 17f8dc2 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-427.18.1.el9_4/17f8dc2d.failed The same list item will be used in both cap_delay_list and cap_unlink_delay_list, so it's buggy to use two different locks to protect them. Cc: stable@vger.kernel.org Fixes: dbc347e ("ceph: add ceph_cap_unlink_work to fire check_caps() immediately") Link: https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/AODC76VXRAMXKLFDCTK4TKFDDPWUSCN5 Reported-by: Marc Ruhmann <ruhmann@luis.uni-hannover.de> Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Tested-by: Marc Ruhmann <ruhmann@luis.uni-hannover.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> (cherry picked from commit 17f8dc2) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # fs/ceph/mds_client.c
1 parent 294d0a2 commit 600b4a2

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
ceph: switch to use cap_delay_lock for the unlink delay list
2+
3+
jira LE-1907
4+
Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4
5+
commit-author Xiubo Li <xiubli@redhat.com>
6+
commit 17f8dc2db52185460f212052f3a692c1fdc167ba
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-427.18.1.el9_4/17f8dc2d.failed
10+
11+
The same list item will be used in both cap_delay_list and
12+
cap_unlink_delay_list, so it's buggy to use two different locks
13+
to protect them.
14+
15+
Cc: stable@vger.kernel.org
16+
Fixes: dbc347ef7f0c ("ceph: add ceph_cap_unlink_work to fire check_caps() immediately")
17+
Link: https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/AODC76VXRAMXKLFDCTK4TKFDDPWUSCN5
18+
Reported-by: Marc Ruhmann <ruhmann@luis.uni-hannover.de>
19+
Signed-off-by: Xiubo Li <xiubli@redhat.com>
20+
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
21+
Tested-by: Marc Ruhmann <ruhmann@luis.uni-hannover.de>
22+
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
23+
(cherry picked from commit 17f8dc2db52185460f212052f3a692c1fdc167ba)
24+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
25+
26+
# Conflicts:
27+
# fs/ceph/mds_client.c
28+
diff --cc fs/ceph/mds_client.c
29+
index cd0677d27683,360b686c3c67..000000000000
30+
--- a/fs/ceph/mds_client.c
31+
+++ b/fs/ceph/mds_client.c
32+
@@@ -2293,9 -2501,10 +2293,14 @@@ static void ceph_cap_unlink_work(struc
33+
{
34+
struct ceph_mds_client *mdsc =
35+
container_of(work, struct ceph_mds_client, cap_unlink_work);
36+
- struct ceph_client *cl = mdsc->fsc->client;
37+
38+
++<<<<<<< HEAD
39+
+ dout("begin\n");
40+
+ spin_lock(&mdsc->cap_unlink_delay_lock);
41+
++=======
42+
+ doutc(cl, "begin\n");
43+
+ spin_lock(&mdsc->cap_delay_lock);
44+
++>>>>>>> 17f8dc2db521 (ceph: switch to use cap_delay_lock for the unlink delay list)
45+
while (!list_empty(&mdsc->cap_unlink_delay_list)) {
46+
struct ceph_inode_info *ci;
47+
struct inode *inode;
48+
@@@ -2307,16 -2516,16 +2312,26 @@@
49+
50+
inode = igrab(&ci->netfs.inode);
51+
if (inode) {
52+
++<<<<<<< HEAD
53+
+ spin_unlock(&mdsc->cap_unlink_delay_lock);
54+
+ dout("on %p %llx.%llx\n", inode,
55+
++=======
56+
+ spin_unlock(&mdsc->cap_delay_lock);
57+
+ doutc(cl, "on %p %llx.%llx\n", inode,
58+
++>>>>>>> 17f8dc2db521 (ceph: switch to use cap_delay_lock for the unlink delay list)
59+
ceph_vinop(inode));
60+
- ceph_check_caps(ci, CHECK_CAPS_FLUSH);
61+
+ ceph_check_caps(ci, CHECK_CAPS_FLUSH, NULL);
62+
iput(inode);
63+
- spin_lock(&mdsc->cap_unlink_delay_lock);
64+
+ spin_lock(&mdsc->cap_delay_lock);
65+
}
66+
}
67+
++<<<<<<< HEAD
68+
+ spin_unlock(&mdsc->cap_unlink_delay_lock);
69+
+ dout("done\n");
70+
++=======
71+
+ spin_unlock(&mdsc->cap_delay_lock);
72+
+ doutc(cl, "done\n");
73+
++>>>>>>> 17f8dc2db521 (ceph: switch to use cap_delay_lock for the unlink delay list)
74+
}
75+
76+
/*
77+
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
78+
index 54545c7f565a..c337c1643906 100644
79+
--- a/fs/ceph/caps.c
80+
+++ b/fs/ceph/caps.c
81+
@@ -4530,13 +4530,13 @@ int ceph_drop_caps_for_unlink(struct inode *inode)
82+
83+
dout("%p %llx.%llx\n", inode,
84+
ceph_vinop(inode));
85+
- spin_lock(&mdsc->cap_unlink_delay_lock);
86+
+ spin_lock(&mdsc->cap_delay_lock);
87+
ci->i_ceph_flags |= CEPH_I_FLUSH;
88+
if (!list_empty(&ci->i_cap_delay_list))
89+
list_del_init(&ci->i_cap_delay_list);
90+
list_add_tail(&ci->i_cap_delay_list,
91+
&mdsc->cap_unlink_delay_list);
92+
- spin_unlock(&mdsc->cap_unlink_delay_lock);
93+
+ spin_unlock(&mdsc->cap_delay_lock);
94+
95+
/*
96+
* Fire the work immediately, because the MDS maybe
97+
* Unmerged path fs/ceph/mds_client.c
98+
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
99+
index b95446ac7620..512b84432de6 100644
100+
--- a/fs/ceph/mds_client.h
101+
+++ b/fs/ceph/mds_client.h
102+
@@ -428,9 +428,8 @@ struct ceph_mds_client {
103+
struct delayed_work delayed_work; /* delayed work */
104+
unsigned long last_renew_caps; /* last time we renewed our caps */
105+
struct list_head cap_delay_list; /* caps with delayed release */
106+
- spinlock_t cap_delay_lock; /* protects cap_delay_list */
107+
struct list_head cap_unlink_delay_list; /* caps with delayed release for unlink */
108+
- spinlock_t cap_unlink_delay_lock; /* protects cap_unlink_delay_list */
109+
+ spinlock_t cap_delay_lock; /* protects cap_delay_list and cap_unlink_delay_list */
110+
struct list_head snap_flush_list; /* cap_snaps ready to flush */
111+
spinlock_t snap_flush_lock;
112+

0 commit comments

Comments
 (0)