• Home
  • Raw
  • Download

Lines Matching refs:lreq

52 			struct ceph_osd_linger_request *lreq);
54 struct ceph_osd_linger_request *lreq);
85 static inline void verify_lreq_locked(struct ceph_osd_linger_request *lreq) in verify_lreq_locked() argument
87 WARN_ON(!mutex_is_locked(&lreq->lock)); in verify_lreq_locked()
93 static inline void verify_lreq_locked(struct ceph_osd_linger_request *lreq) { } in verify_lreq_locked() argument
1307 struct ceph_osd_linger_request *lreq = in close_osd() local
1312 dout(" reassigning lreq %p linger_id %llu\n", lreq, in close_osd()
1313 lreq->linger_id); in close_osd()
1314 unlink_linger(osd, lreq); in close_osd()
1315 link_linger(&osdc->homeless_osd, lreq); in close_osd()
2697 struct ceph_osd_linger_request *lreq = in linger_release() local
2700 dout("%s lreq %p reg_req %p ping_req %p\n", __func__, lreq, in linger_release()
2701 lreq->reg_req, lreq->ping_req); in linger_release()
2702 WARN_ON(!RB_EMPTY_NODE(&lreq->node)); in linger_release()
2703 WARN_ON(!RB_EMPTY_NODE(&lreq->osdc_node)); in linger_release()
2704 WARN_ON(!RB_EMPTY_NODE(&lreq->mc_node)); in linger_release()
2705 WARN_ON(!list_empty(&lreq->scan_item)); in linger_release()
2706 WARN_ON(!list_empty(&lreq->pending_lworks)); in linger_release()
2707 WARN_ON(lreq->osd); in linger_release()
2709 if (lreq->request_pl) in linger_release()
2710 ceph_pagelist_release(lreq->request_pl); in linger_release()
2711 if (lreq->notify_id_pages) in linger_release()
2712 ceph_release_page_vector(lreq->notify_id_pages, 1); in linger_release()
2714 ceph_osdc_put_request(lreq->reg_req); in linger_release()
2715 ceph_osdc_put_request(lreq->ping_req); in linger_release()
2716 target_destroy(&lreq->t); in linger_release()
2717 kfree(lreq); in linger_release()
2720 static void linger_put(struct ceph_osd_linger_request *lreq) in linger_put() argument
2722 if (lreq) in linger_put()
2723 kref_put(&lreq->kref, linger_release); in linger_put()
2727 linger_get(struct ceph_osd_linger_request *lreq) in linger_get() argument
2729 kref_get(&lreq->kref); in linger_get()
2730 return lreq; in linger_get()
2736 struct ceph_osd_linger_request *lreq; in linger_alloc() local
2738 lreq = kzalloc(sizeof(*lreq), GFP_NOIO); in linger_alloc()
2739 if (!lreq) in linger_alloc()
2742 kref_init(&lreq->kref); in linger_alloc()
2743 mutex_init(&lreq->lock); in linger_alloc()
2744 RB_CLEAR_NODE(&lreq->node); in linger_alloc()
2745 RB_CLEAR_NODE(&lreq->osdc_node); in linger_alloc()
2746 RB_CLEAR_NODE(&lreq->mc_node); in linger_alloc()
2747 INIT_LIST_HEAD(&lreq->scan_item); in linger_alloc()
2748 INIT_LIST_HEAD(&lreq->pending_lworks); in linger_alloc()
2749 init_completion(&lreq->reg_commit_wait); in linger_alloc()
2750 init_completion(&lreq->notify_finish_wait); in linger_alloc()
2752 lreq->osdc = osdc; in linger_alloc()
2753 target_init(&lreq->t); in linger_alloc()
2755 dout("%s lreq %p\n", __func__, lreq); in linger_alloc()
2756 return lreq; in linger_alloc()
2769 struct ceph_osd_linger_request *lreq) in DEFINE_RB_INSDEL_FUNCS()
2772 WARN_ON(!lreq->linger_id || lreq->osd); in DEFINE_RB_INSDEL_FUNCS()
2774 osd->o_osd, lreq, lreq->linger_id); in DEFINE_RB_INSDEL_FUNCS()
2782 insert_linger(&osd->o_linger_requests, lreq); in DEFINE_RB_INSDEL_FUNCS()
2783 lreq->osd = osd; in DEFINE_RB_INSDEL_FUNCS()
2787 struct ceph_osd_linger_request *lreq) in unlink_linger() argument
2790 WARN_ON(lreq->osd != osd); in unlink_linger()
2792 osd->o_osd, lreq, lreq->linger_id); in unlink_linger()
2794 lreq->osd = NULL; in unlink_linger()
2795 erase_linger(&osd->o_linger_requests, lreq); in unlink_linger()
2804 static bool __linger_registered(struct ceph_osd_linger_request *lreq) in __linger_registered() argument
2806 verify_osdc_locked(lreq->osdc); in __linger_registered()
2808 return !RB_EMPTY_NODE(&lreq->osdc_node); in __linger_registered()
2811 static bool linger_registered(struct ceph_osd_linger_request *lreq) in linger_registered() argument
2813 struct ceph_osd_client *osdc = lreq->osdc; in linger_registered()
2817 registered = __linger_registered(lreq); in linger_registered()
2823 static void linger_register(struct ceph_osd_linger_request *lreq) in linger_register() argument
2825 struct ceph_osd_client *osdc = lreq->osdc; in linger_register()
2828 WARN_ON(lreq->linger_id); in linger_register()
2830 linger_get(lreq); in linger_register()
2831 lreq->linger_id = ++osdc->last_linger_id; in linger_register()
2832 insert_linger_osdc(&osdc->linger_requests, lreq); in linger_register()
2835 static void linger_unregister(struct ceph_osd_linger_request *lreq) in linger_unregister() argument
2837 struct ceph_osd_client *osdc = lreq->osdc; in linger_unregister()
2841 erase_linger_osdc(&osdc->linger_requests, lreq); in linger_unregister()
2842 linger_put(lreq); in linger_unregister()
2847 struct ceph_osd_linger_request *lreq = req->r_priv; in cancel_linger_request() local
2851 linger_put(lreq); in cancel_linger_request()
2856 struct ceph_osd_linger_request *lreq; member
2875 static struct linger_work *lwork_alloc(struct ceph_osd_linger_request *lreq, in lwork_alloc() argument
2886 lwork->lreq = linger_get(lreq); in lwork_alloc()
2893 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_free() local
2895 mutex_lock(&lreq->lock); in lwork_free()
2897 mutex_unlock(&lreq->lock); in lwork_free()
2899 linger_put(lreq); in lwork_free()
2905 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_queue() local
2906 struct ceph_osd_client *osdc = lreq->osdc; in lwork_queue()
2908 verify_lreq_locked(lreq); in lwork_queue()
2912 list_add_tail(&lwork->pending_item, &lreq->pending_lworks); in lwork_queue()
2919 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_notify() local
2921 if (!linger_registered(lreq)) { in do_watch_notify()
2922 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_notify()
2926 WARN_ON(!lreq->is_watch); in do_watch_notify()
2928 __func__, lreq, lwork->notify.notify_id, lwork->notify.notifier_id, in do_watch_notify()
2930 lreq->wcb(lreq->data, lwork->notify.notify_id, lreq->linger_id, in do_watch_notify()
2942 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_error() local
2944 if (!linger_registered(lreq)) { in do_watch_error()
2945 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_error()
2949 dout("%s lreq %p err %d\n", __func__, lreq, lwork->error.err); in do_watch_error()
2950 lreq->errcb(lreq->data, lreq->linger_id, lwork->error.err); in do_watch_error()
2956 static void queue_watch_error(struct ceph_osd_linger_request *lreq) in queue_watch_error() argument
2960 lwork = lwork_alloc(lreq, do_watch_error); in queue_watch_error()
2966 lwork->error.err = lreq->last_error; in queue_watch_error()
2970 static void linger_reg_commit_complete(struct ceph_osd_linger_request *lreq, in linger_reg_commit_complete() argument
2973 if (!completion_done(&lreq->reg_commit_wait)) { in linger_reg_commit_complete()
2974 lreq->reg_commit_error = (result <= 0 ? result : 0); in linger_reg_commit_complete()
2975 complete_all(&lreq->reg_commit_wait); in linger_reg_commit_complete()
2981 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_commit_cb() local
2983 mutex_lock(&lreq->lock); in linger_commit_cb()
2984 if (req != lreq->reg_req) { in linger_commit_cb()
2986 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_commit_cb()
2990 dout("%s lreq %p linger_id %llu result %d\n", __func__, lreq, in linger_commit_cb()
2991 lreq->linger_id, req->r_result); in linger_commit_cb()
2992 linger_reg_commit_complete(lreq, req->r_result); in linger_commit_cb()
2993 lreq->committed = true; in linger_commit_cb()
2995 if (!lreq->is_watch) { in linger_commit_cb()
3005 lreq->notify_id = ceph_decode_64(&p); in linger_commit_cb()
3006 dout("lreq %p notify_id %llu\n", lreq, in linger_commit_cb()
3007 lreq->notify_id); in linger_commit_cb()
3009 dout("lreq %p no notify_id\n", lreq); in linger_commit_cb()
3014 mutex_unlock(&lreq->lock); in linger_commit_cb()
3015 linger_put(lreq); in linger_commit_cb()
3033 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_reconnect_cb() local
3035 mutex_lock(&lreq->lock); in linger_reconnect_cb()
3036 if (req != lreq->reg_req) { in linger_reconnect_cb()
3038 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_reconnect_cb()
3043 lreq, lreq->linger_id, req->r_result, lreq->last_error); in linger_reconnect_cb()
3045 if (!lreq->last_error) { in linger_reconnect_cb()
3046 lreq->last_error = normalize_watch_error(req->r_result); in linger_reconnect_cb()
3047 queue_watch_error(lreq); in linger_reconnect_cb()
3052 mutex_unlock(&lreq->lock); in linger_reconnect_cb()
3053 linger_put(lreq); in linger_reconnect_cb()
3056 static void send_linger(struct ceph_osd_linger_request *lreq) in send_linger() argument
3058 struct ceph_osd_client *osdc = lreq->osdc; in send_linger()
3063 mutex_lock(&lreq->lock); in send_linger()
3064 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in send_linger()
3066 if (lreq->reg_req) { in send_linger()
3067 if (lreq->reg_req->r_osd) in send_linger()
3068 cancel_linger_request(lreq->reg_req); in send_linger()
3069 ceph_osdc_put_request(lreq->reg_req); in send_linger()
3075 target_copy(&req->r_t, &lreq->t); in send_linger()
3076 req->r_mtime = lreq->mtime; in send_linger()
3078 if (lreq->is_watch && lreq->committed) { in send_linger()
3080 lreq->linger_id, ++lreq->register_gen); in send_linger()
3081 dout("lreq %p reconnect register_gen %u\n", lreq, in send_linger()
3085 if (lreq->is_watch) { in send_linger()
3087 lreq->linger_id, 0); in send_linger()
3089 lreq->notify_id = 0; in send_linger()
3091 refcount_inc(&lreq->request_pl->refcnt); in send_linger()
3092 osd_req_op_notify_init(req, 0, lreq->linger_id, in send_linger()
3093 lreq->request_pl); in send_linger()
3096 lreq->notify_id_pages, PAGE_SIZE, 0, false, false); in send_linger()
3098 dout("lreq %p register\n", lreq); in send_linger()
3105 req->r_priv = linger_get(lreq); in send_linger()
3107 lreq->reg_req = req; in send_linger()
3108 mutex_unlock(&lreq->lock); in send_linger()
3115 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_ping_cb() local
3117 mutex_lock(&lreq->lock); in linger_ping_cb()
3118 if (req != lreq->ping_req) { in linger_ping_cb()
3120 __func__, lreq, lreq->linger_id, req, lreq->ping_req); in linger_ping_cb()
3125 __func__, lreq, lreq->linger_id, req->r_result, lreq->ping_sent, in linger_ping_cb()
3126 lreq->last_error); in linger_ping_cb()
3127 if (lreq->register_gen == req->r_ops[0].watch.gen) { in linger_ping_cb()
3129 lreq->watch_valid_thru = lreq->ping_sent; in linger_ping_cb()
3130 } else if (!lreq->last_error) { in linger_ping_cb()
3131 lreq->last_error = normalize_watch_error(req->r_result); in linger_ping_cb()
3132 queue_watch_error(lreq); in linger_ping_cb()
3135 dout("lreq %p register_gen %u ignoring old pong %u\n", lreq, in linger_ping_cb()
3136 lreq->register_gen, req->r_ops[0].watch.gen); in linger_ping_cb()
3140 mutex_unlock(&lreq->lock); in linger_ping_cb()
3141 linger_put(lreq); in linger_ping_cb()
3144 static void send_linger_ping(struct ceph_osd_linger_request *lreq) in send_linger_ping() argument
3146 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_ping()
3155 lreq->ping_sent = jiffies; in send_linger_ping()
3157 __func__, lreq, lreq->linger_id, lreq->ping_sent, in send_linger_ping()
3158 lreq->register_gen); in send_linger_ping()
3160 if (lreq->ping_req) { in send_linger_ping()
3161 if (lreq->ping_req->r_osd) in send_linger_ping()
3162 cancel_linger_request(lreq->ping_req); in send_linger_ping()
3163 ceph_osdc_put_request(lreq->ping_req); in send_linger_ping()
3169 target_copy(&req->r_t, &lreq->t); in send_linger_ping()
3170 osd_req_op_watch_init(req, 0, CEPH_OSD_WATCH_OP_PING, lreq->linger_id, in send_linger_ping()
3171 lreq->register_gen); in send_linger_ping()
3177 req->r_priv = linger_get(lreq); in send_linger_ping()
3179 lreq->ping_req = req; in send_linger_ping()
3184 link_request(lreq->osd, req); in send_linger_ping()
3188 static void linger_submit(struct ceph_osd_linger_request *lreq) in linger_submit() argument
3190 struct ceph_osd_client *osdc = lreq->osdc; in linger_submit()
3194 linger_register(lreq); in linger_submit()
3196 calc_target(osdc, &lreq->t, false); in linger_submit()
3197 osd = lookup_create_osd(osdc, lreq->t.osd, true); in linger_submit()
3198 link_linger(osd, lreq); in linger_submit()
3200 send_linger(lreq); in linger_submit()
3204 static void cancel_linger_map_check(struct ceph_osd_linger_request *lreq) in cancel_linger_map_check() argument
3206 struct ceph_osd_client *osdc = lreq->osdc; in cancel_linger_map_check()
3212 lreq->linger_id); in cancel_linger_map_check()
3216 WARN_ON(lookup_lreq != lreq); in cancel_linger_map_check()
3217 erase_linger_mc(&osdc->linger_map_checks, lreq); in cancel_linger_map_check()
3218 linger_put(lreq); in cancel_linger_map_check()
3224 static void __linger_cancel(struct ceph_osd_linger_request *lreq) in __linger_cancel() argument
3226 if (lreq->ping_req && lreq->ping_req->r_osd) in __linger_cancel()
3227 cancel_linger_request(lreq->ping_req); in __linger_cancel()
3228 if (lreq->reg_req && lreq->reg_req->r_osd) in __linger_cancel()
3229 cancel_linger_request(lreq->reg_req); in __linger_cancel()
3230 cancel_linger_map_check(lreq); in __linger_cancel()
3231 unlink_linger(lreq->osd, lreq); in __linger_cancel()
3232 linger_unregister(lreq); in __linger_cancel()
3235 static void linger_cancel(struct ceph_osd_linger_request *lreq) in linger_cancel() argument
3237 struct ceph_osd_client *osdc = lreq->osdc; in linger_cancel()
3240 if (__linger_registered(lreq)) in linger_cancel()
3241 __linger_cancel(lreq); in linger_cancel()
3245 static void send_linger_map_check(struct ceph_osd_linger_request *lreq);
3247 static void check_linger_pool_dne(struct ceph_osd_linger_request *lreq) in check_linger_pool_dne() argument
3249 struct ceph_osd_client *osdc = lreq->osdc; in check_linger_pool_dne()
3255 if (lreq->register_gen) { in check_linger_pool_dne()
3256 lreq->map_dne_bound = map->epoch; in check_linger_pool_dne()
3258 lreq, lreq->linger_id); in check_linger_pool_dne()
3261 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in check_linger_pool_dne()
3265 if (lreq->map_dne_bound) { in check_linger_pool_dne()
3266 if (map->epoch >= lreq->map_dne_bound) { in check_linger_pool_dne()
3269 lreq->linger_id); in check_linger_pool_dne()
3270 linger_reg_commit_complete(lreq, -ENOENT); in check_linger_pool_dne()
3271 __linger_cancel(lreq); in check_linger_pool_dne()
3274 send_linger_map_check(lreq); in check_linger_pool_dne()
3281 struct ceph_osd_linger_request *lreq; in linger_map_check_cb() local
3287 lreq = lookup_linger_mc(&osdc->linger_map_checks, linger_id); in linger_map_check_cb()
3288 if (!lreq) { in linger_map_check_cb()
3294 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in linger_map_check_cb()
3296 if (!lreq->map_dne_bound) in linger_map_check_cb()
3297 lreq->map_dne_bound = greq->u.newest; in linger_map_check_cb()
3298 erase_linger_mc(&osdc->linger_map_checks, lreq); in linger_map_check_cb()
3299 check_linger_pool_dne(lreq); in linger_map_check_cb()
3301 linger_put(lreq); in linger_map_check_cb()
3306 static void send_linger_map_check(struct ceph_osd_linger_request *lreq) in send_linger_map_check() argument
3308 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_map_check()
3315 lreq->linger_id); in send_linger_map_check()
3317 WARN_ON(lookup_lreq != lreq); in send_linger_map_check()
3321 linger_get(lreq); in send_linger_map_check()
3322 insert_linger_mc(&osdc->linger_map_checks, lreq); in send_linger_map_check()
3324 linger_map_check_cb, lreq->linger_id); in send_linger_map_check()
3328 static int linger_reg_commit_wait(struct ceph_osd_linger_request *lreq) in linger_reg_commit_wait() argument
3332 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_reg_commit_wait()
3333 ret = wait_for_completion_interruptible(&lreq->reg_commit_wait); in linger_reg_commit_wait()
3334 return ret ?: lreq->reg_commit_error; in linger_reg_commit_wait()
3337 static int linger_notify_finish_wait(struct ceph_osd_linger_request *lreq) in linger_notify_finish_wait() argument
3341 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_notify_finish_wait()
3342 ret = wait_for_completion_interruptible(&lreq->notify_finish_wait); in linger_notify_finish_wait()
3343 return ret ?: lreq->notify_finish_error; in linger_notify_finish_wait()
3393 struct ceph_osd_linger_request *lreq = in handle_timeout() local
3397 lreq, lreq->linger_id, osd->o_osd); in handle_timeout()
3400 mutex_lock(&lreq->lock); in handle_timeout()
3401 if (lreq->is_watch && lreq->committed && !lreq->last_error) in handle_timeout()
3402 send_linger_ping(lreq); in handle_timeout()
3403 mutex_unlock(&lreq->lock); in handle_timeout()
3827 recalc_linger_target(struct ceph_osd_linger_request *lreq) in recalc_linger_target() argument
3829 struct ceph_osd_client *osdc = lreq->osdc; in recalc_linger_target()
3832 ct_res = calc_target(osdc, &lreq->t, true); in recalc_linger_target()
3836 osd = lookup_create_osd(osdc, lreq->t.osd, true); in recalc_linger_target()
3837 if (osd != lreq->osd) { in recalc_linger_target()
3838 unlink_linger(lreq->osd, lreq); in recalc_linger_target()
3839 link_linger(osd, lreq); in recalc_linger_target()
3861 struct ceph_osd_linger_request *lreq = in scan_requests() local
3867 dout("%s lreq %p linger_id %llu\n", __func__, lreq, in scan_requests()
3868 lreq->linger_id); in scan_requests()
3869 ct_res = recalc_linger_target(lreq); in scan_requests()
3874 pool_cleared_full(osdc, lreq->t.base_oloc.pool)); in scan_requests()
3880 cancel_linger_map_check(lreq); in scan_requests()
3886 if (list_empty(&lreq->scan_item)) in scan_requests()
3887 list_add_tail(&lreq->scan_item, need_resend_linger); in scan_requests()
3890 list_del_init(&lreq->scan_item); in scan_requests()
3891 check_linger_pool_dne(lreq); in scan_requests()
4001 struct ceph_osd_linger_request *lreq, *nlreq; in kick_requests() local
4039 list_for_each_entry_safe(lreq, nlreq, need_resend_linger, scan_item) { in kick_requests()
4040 if (!osd_homeless(lreq->osd)) in kick_requests()
4041 send_linger(lreq); in kick_requests()
4043 list_del_init(&lreq->scan_item); in kick_requests()
4187 struct ceph_osd_linger_request *lreq = in kick_osd_requests() local
4190 send_linger(lreq); in kick_osd_requests()
4481 struct ceph_osd_linger_request *lreq; in handle_watch_notify() local
4510 lreq = lookup_linger_osdc(&osdc->linger_requests, cookie); in handle_watch_notify()
4511 if (!lreq) { in handle_watch_notify()
4517 mutex_lock(&lreq->lock); in handle_watch_notify()
4519 opcode, cookie, lreq, lreq->is_watch); in handle_watch_notify()
4521 if (!lreq->last_error) { in handle_watch_notify()
4522 lreq->last_error = -ENOTCONN; in handle_watch_notify()
4523 queue_watch_error(lreq); in handle_watch_notify()
4525 } else if (!lreq->is_watch) { in handle_watch_notify()
4527 if (lreq->notify_id && lreq->notify_id != notify_id) { in handle_watch_notify()
4528 dout("lreq %p notify_id %llu != %llu, ignoring\n", lreq, in handle_watch_notify()
4529 lreq->notify_id, notify_id); in handle_watch_notify()
4530 } else if (!completion_done(&lreq->notify_finish_wait)) { in handle_watch_notify()
4535 if (lreq->preply_pages) { in handle_watch_notify()
4538 *lreq->preply_pages = data->pages; in handle_watch_notify()
4539 *lreq->preply_len = data->length; in handle_watch_notify()
4543 lreq->notify_finish_error = return_code; in handle_watch_notify()
4544 complete_all(&lreq->notify_finish_wait); in handle_watch_notify()
4548 lwork = lwork_alloc(lreq, do_watch_notify); in handle_watch_notify()
4563 mutex_unlock(&lreq->lock); in handle_watch_notify()
4686 struct ceph_osd_linger_request *lreq; in ceph_osdc_watch() local
4689 lreq = linger_alloc(osdc); in ceph_osdc_watch()
4690 if (!lreq) in ceph_osdc_watch()
4693 lreq->is_watch = true; in ceph_osdc_watch()
4694 lreq->wcb = wcb; in ceph_osdc_watch()
4695 lreq->errcb = errcb; in ceph_osdc_watch()
4696 lreq->data = data; in ceph_osdc_watch()
4697 lreq->watch_valid_thru = jiffies; in ceph_osdc_watch()
4699 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_watch()
4700 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_watch()
4701 lreq->t.flags = CEPH_OSD_FLAG_WRITE; in ceph_osdc_watch()
4702 ktime_get_real_ts64(&lreq->mtime); in ceph_osdc_watch()
4704 linger_submit(lreq); in ceph_osdc_watch()
4705 ret = linger_reg_commit_wait(lreq); in ceph_osdc_watch()
4707 linger_cancel(lreq); in ceph_osdc_watch()
4711 return lreq; in ceph_osdc_watch()
4714 linger_put(lreq); in ceph_osdc_watch()
4727 struct ceph_osd_linger_request *lreq) in ceph_osdc_unwatch() argument
4737 ceph_oid_copy(&req->r_base_oid, &lreq->t.base_oid); in ceph_osdc_unwatch()
4738 ceph_oloc_copy(&req->r_base_oloc, &lreq->t.base_oloc); in ceph_osdc_unwatch()
4742 lreq->linger_id, 0); in ceph_osdc_unwatch()
4749 linger_cancel(lreq); in ceph_osdc_unwatch()
4750 linger_put(lreq); in ceph_osdc_unwatch()
4845 struct ceph_osd_linger_request *lreq; in ceph_osdc_notify() local
4854 lreq = linger_alloc(osdc); in ceph_osdc_notify()
4855 if (!lreq) in ceph_osdc_notify()
4858 lreq->request_pl = ceph_pagelist_alloc(GFP_NOIO); in ceph_osdc_notify()
4859 if (!lreq->request_pl) { in ceph_osdc_notify()
4864 ret = ceph_pagelist_encode_32(lreq->request_pl, 1); /* prot_ver */ in ceph_osdc_notify()
4865 ret |= ceph_pagelist_encode_32(lreq->request_pl, timeout); in ceph_osdc_notify()
4866 ret |= ceph_pagelist_encode_32(lreq->request_pl, payload_len); in ceph_osdc_notify()
4867 ret |= ceph_pagelist_append(lreq->request_pl, payload, payload_len); in ceph_osdc_notify()
4874 lreq->notify_id_pages = ceph_alloc_page_vector(1, GFP_NOIO); in ceph_osdc_notify()
4875 if (IS_ERR(lreq->notify_id_pages)) { in ceph_osdc_notify()
4876 ret = PTR_ERR(lreq->notify_id_pages); in ceph_osdc_notify()
4877 lreq->notify_id_pages = NULL; in ceph_osdc_notify()
4881 lreq->preply_pages = preply_pages; in ceph_osdc_notify()
4882 lreq->preply_len = preply_len; in ceph_osdc_notify()
4884 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_notify()
4885 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_notify()
4886 lreq->t.flags = CEPH_OSD_FLAG_READ; in ceph_osdc_notify()
4888 linger_submit(lreq); in ceph_osdc_notify()
4889 ret = linger_reg_commit_wait(lreq); in ceph_osdc_notify()
4891 ret = linger_notify_finish_wait(lreq); in ceph_osdc_notify()
4893 dout("lreq %p failed to initiate notify %d\n", lreq, ret); in ceph_osdc_notify()
4895 linger_cancel(lreq); in ceph_osdc_notify()
4897 linger_put(lreq); in ceph_osdc_notify()
4908 struct ceph_osd_linger_request *lreq) in ceph_osdc_watch_check() argument
4914 mutex_lock(&lreq->lock); in ceph_osdc_watch_check()
4915 stamp = lreq->watch_valid_thru; in ceph_osdc_watch_check()
4916 if (!list_empty(&lreq->pending_lworks)) { in ceph_osdc_watch_check()
4918 list_first_entry(&lreq->pending_lworks, in ceph_osdc_watch_check()
4927 lreq, lreq->linger_id, age, lreq->last_error); in ceph_osdc_watch_check()
4929 ret = lreq->last_error ?: 1 + jiffies_to_msecs(age); in ceph_osdc_watch_check()
4931 mutex_unlock(&lreq->lock); in ceph_osdc_watch_check()