Skip to contentSkip to conversation

ceph: properly wake up cap waiter after releasing revoked caps

PATCH In review Yan, Zheng 2 participants 2 messages May 11, 2020 Ceph client

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 ceph: properly wake up cap waiter after releasing revoked caps

arg->wake can never be true. the bug was introduced by commit 0c4b255369bcf "ceph: reorganize __send_cap for less spinlock abuse"

---
 fs/ceph/caps.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
fs/ceph/caps.c +6 -7
index b3e65c89ba6e..a2a2cda117e0 100644
@@ -1376,6 +1376,12 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
 	ci->i_ceph_flags &= ~CEPH_I_FLUSH;
 
 	cap->issued &= retain;  /* drop bits we don't want */
+	/*
+	 * Wake up any waiters on wanted -> needed transition. This is due to
+	 * the weird transition from buffered to sync IO... we need to flush
+	 * dirty pages _before_ allowing sync writes to avoid reordering.
+	 */
+	arg->wake = cap->implemented & ~cap->issued;
 	cap->implemented &= cap->issued | used;
 	cap->mds_wanted = want;
 
@@ -1439,13 +1445,6 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
 		}
 	}
 	arg->flags = flags;
-
-	/*
-	 * Wake up any waiters on wanted -> needed transition. This is due to
-	 * the weird transition from buffered to sync IO... we need to flush
-	 * dirty pages _before_ allowing sync writes to avoid reordering.
-	 */
-	arg->wake = cap->implemented & ~cap->issued;
 }
 
 /*
Signature · 1 line
2.21.3
#1 lore raw
Quoted 29 lines · Zheng

arg->wake can never be true. the bug was introduced by commit 0c4b255369bcf "ceph: reorganize __send_cap for less spinlock abuse"

---
 fs/ceph/caps.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
fs/ceph/caps.c +6 -0
index b3e65c89ba6e..a2a2cda117e0 100644
@@ -1376,6 +1376,12 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
 	ci->i_ceph_flags &= ~CEPH_I_FLUSH;
 
 	cap->issued &= retain;  /* drop bits we don't want */
+	/*
+	 * Wake up any waiters on wanted -> needed transition. This is due to
+	 * the weird transition from buffered to sync IO... we need to flush
+	 * dirty pages _before_ allowing sync writes to avoid reordering.
+	 */
+	arg->wake = cap->implemented & ~cap->issued;
 	cap->implemented &= cap->issued | used;
 	cap->mds_wanted = want;
 
@@ -1439,13 +1445,6 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
 		}
 	}
 	arg->flags = flags;

fs/ceph/caps.c static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap, · line 1450

Quoted 10 lines
fs/ceph/caps.c +0 -7
-
-	/*
-	 * Wake up any waiters on wanted -> needed transition. This is due to
-	 * the weird transition from buffered to sync IO... we need to flush
-	 * dirty pages _before_ allowing sync writes to avoid reordering.
-	 */
-	arg->wake = cap->implemented & ~cap->issued;
 }
 
 /*

Good catch! Merged (with a small revision to the commit message).

Signature · 1 line
Jeff Layton <[email protected]>