@@ -2998,11 +2998,21 @@ static void linger_submit(struct ceph_osd_linger_request *lreq)
2998
2998
struct ceph_osd_client * osdc = lreq -> osdc ;
2999
2999
struct ceph_osd * osd ;
3000
3000
3001
+ down_write (& osdc -> lock );
3002
+ linger_register (lreq );
3003
+ if (lreq -> is_watch ) {
3004
+ lreq -> reg_req -> r_ops [0 ].watch .cookie = lreq -> linger_id ;
3005
+ lreq -> ping_req -> r_ops [0 ].watch .cookie = lreq -> linger_id ;
3006
+ } else {
3007
+ lreq -> reg_req -> r_ops [0 ].notify .cookie = lreq -> linger_id ;
3008
+ }
3009
+
3001
3010
calc_target (osdc , & lreq -> t , NULL , false);
3002
3011
osd = lookup_create_osd (osdc , lreq -> t .osd , true);
3003
3012
link_linger (osd , lreq );
3004
3013
3005
3014
send_linger (lreq );
3015
+ up_write (& osdc -> lock );
3006
3016
}
3007
3017
3008
3018
static void cancel_linger_map_check (struct ceph_osd_linger_request * lreq )
@@ -4523,15 +4533,14 @@ ceph_osdc_watch(struct ceph_osd_client *osdc,
4523
4533
goto err_put_lreq ;
4524
4534
}
4525
4535
4526
- down_write (& osdc -> lock );
4527
- linger_register (lreq ); /* before osd_req_op_* */
4528
- osd_req_op_watch_init (lreq -> reg_req , 0 , lreq -> linger_id ,
4529
- CEPH_OSD_WATCH_OP_WATCH );
4530
- osd_req_op_watch_init (lreq -> ping_req , 0 , lreq -> linger_id ,
4531
- CEPH_OSD_WATCH_OP_PING );
4532
- linger_submit (lreq );
4533
- up_write (& osdc -> lock );
4536
+ /*
4537
+ * Pass 0 for cookie because we don't know it yet, it will be
4538
+ * filled in by linger_submit().
4539
+ */
4540
+ osd_req_op_watch_init (lreq -> reg_req , 0 , 0 , CEPH_OSD_WATCH_OP_WATCH );
4541
+ osd_req_op_watch_init (lreq -> ping_req , 0 , 0 , CEPH_OSD_WATCH_OP_PING );
4534
4542
4543
+ linger_submit (lreq );
4535
4544
ret = linger_reg_commit_wait (lreq );
4536
4545
if (ret ) {
4537
4546
linger_cancel (lreq );
@@ -4728,29 +4737,26 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc,
4728
4737
goto out_put_lreq ;
4729
4738
}
4730
4739
4740
+ /*
4741
+ * Pass 0 for cookie because we don't know it yet, it will be
4742
+ * filled in by linger_submit().
4743
+ */
4744
+ ret = osd_req_op_notify_init (lreq -> reg_req , 0 , 0 , 1 , timeout ,
4745
+ payload , payload_len );
4746
+ if (ret )
4747
+ goto out_put_lreq ;
4748
+
4731
4749
/* for notify_id */
4732
4750
pages = ceph_alloc_page_vector (1 , GFP_NOIO );
4733
4751
if (IS_ERR (pages )) {
4734
4752
ret = PTR_ERR (pages );
4735
4753
goto out_put_lreq ;
4736
4754
}
4737
-
4738
- down_write (& osdc -> lock );
4739
- linger_register (lreq ); /* before osd_req_op_* */
4740
- ret = osd_req_op_notify_init (lreq -> reg_req , 0 , lreq -> linger_id , 1 ,
4741
- timeout , payload , payload_len );
4742
- if (ret ) {
4743
- linger_unregister (lreq );
4744
- up_write (& osdc -> lock );
4745
- ceph_release_page_vector (pages , 1 );
4746
- goto out_put_lreq ;
4747
- }
4748
4755
ceph_osd_data_pages_init (osd_req_op_data (lreq -> reg_req , 0 , notify ,
4749
4756
response_data ),
4750
4757
pages , PAGE_SIZE , 0 , false, true);
4751
- linger_submit (lreq );
4752
- up_write (& osdc -> lock );
4753
4758
4759
+ linger_submit (lreq );
4754
4760
ret = linger_reg_commit_wait (lreq );
4755
4761
if (!ret )
4756
4762
ret = linger_notify_finish_wait (lreq );
0 commit comments