Lines Matching full: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
1359 struct ceph_osd_linger_request *lreq = in close_osd() local
1364 dout(" reassigning lreq %p linger_id %llu\n", lreq, in close_osd()
1365 lreq->linger_id); in close_osd()
1366 unlink_linger(osd, lreq); in close_osd()
1367 link_linger(&osdc->homeless_osd, lreq); in close_osd()
2767 struct ceph_osd_linger_request *lreq = in linger_release() local
2770 dout("%s lreq %p reg_req %p ping_req %p\n", __func__, lreq, in linger_release()
2771 lreq->reg_req, lreq->ping_req); in linger_release()
2772 WARN_ON(!RB_EMPTY_NODE(&lreq->node)); in linger_release()
2773 WARN_ON(!RB_EMPTY_NODE(&lreq->osdc_node)); in linger_release()
2774 WARN_ON(!RB_EMPTY_NODE(&lreq->mc_node)); in linger_release()
2775 WARN_ON(!list_empty(&lreq->scan_item)); in linger_release()
2776 WARN_ON(!list_empty(&lreq->pending_lworks)); in linger_release()
2777 WARN_ON(lreq->osd); in linger_release()
2779 if (lreq->request_pl) in linger_release()
2780 ceph_pagelist_release(lreq->request_pl); in linger_release()
2781 if (lreq->notify_id_pages) in linger_release()
2782 ceph_release_page_vector(lreq->notify_id_pages, 1); in linger_release()
2784 ceph_osdc_put_request(lreq->reg_req); in linger_release()
2785 ceph_osdc_put_request(lreq->ping_req); in linger_release()
2786 target_destroy(&lreq->t); in linger_release()
2787 kfree(lreq); in linger_release()
2790 static void linger_put(struct ceph_osd_linger_request *lreq) in linger_put() argument
2792 if (lreq) in linger_put()
2793 kref_put(&lreq->kref, linger_release); in linger_put()
2797 linger_get(struct ceph_osd_linger_request *lreq) in linger_get() argument
2799 kref_get(&lreq->kref); in linger_get()
2800 return lreq; in linger_get()
2806 struct ceph_osd_linger_request *lreq; in linger_alloc() local
2808 lreq = kzalloc_obj(*lreq, GFP_NOIO); in linger_alloc()
2809 if (!lreq) in linger_alloc()
2812 kref_init(&lreq->kref); in linger_alloc()
2813 mutex_init(&lreq->lock); in linger_alloc()
2814 RB_CLEAR_NODE(&lreq->node); in linger_alloc()
2815 RB_CLEAR_NODE(&lreq->osdc_node); in linger_alloc()
2816 RB_CLEAR_NODE(&lreq->mc_node); in linger_alloc()
2817 INIT_LIST_HEAD(&lreq->scan_item); in linger_alloc()
2818 INIT_LIST_HEAD(&lreq->pending_lworks); in linger_alloc()
2819 init_completion(&lreq->reg_commit_wait); in linger_alloc()
2820 init_completion(&lreq->notify_finish_wait); in linger_alloc()
2822 lreq->osdc = osdc; in linger_alloc()
2823 target_init(&lreq->t); in linger_alloc()
2825 dout("%s lreq %p\n", __func__, lreq); in linger_alloc()
2826 return lreq; in linger_alloc()
2836 * @lreq has to be registered, @osd may be homeless. in DEFINE_RB_INSDEL_FUNCS()
2839 struct ceph_osd_linger_request *lreq) in DEFINE_RB_INSDEL_FUNCS()
2842 WARN_ON(!lreq->linger_id || lreq->osd); in DEFINE_RB_INSDEL_FUNCS()
2843 dout("%s osd %p osd%d lreq %p linger_id %llu\n", __func__, osd, in DEFINE_RB_INSDEL_FUNCS()
2844 osd->o_osd, lreq, lreq->linger_id); in DEFINE_RB_INSDEL_FUNCS()
2852 insert_linger(&osd->o_linger_requests, lreq); in DEFINE_RB_INSDEL_FUNCS()
2853 lreq->osd = osd; in DEFINE_RB_INSDEL_FUNCS()
2857 struct ceph_osd_linger_request *lreq) in unlink_linger() argument
2860 WARN_ON(lreq->osd != osd); in unlink_linger()
2861 dout("%s osd %p osd%d lreq %p linger_id %llu\n", __func__, osd, in unlink_linger()
2862 osd->o_osd, lreq, lreq->linger_id); in unlink_linger()
2864 lreq->osd = NULL; in unlink_linger()
2865 erase_linger(&osd->o_linger_requests, lreq); in unlink_linger()
2874 static bool __linger_registered(struct ceph_osd_linger_request *lreq) in __linger_registered() argument
2876 verify_osdc_locked(lreq->osdc); in __linger_registered()
2878 return !RB_EMPTY_NODE(&lreq->osdc_node); in __linger_registered()
2881 static bool linger_registered(struct ceph_osd_linger_request *lreq) in linger_registered() argument
2883 struct ceph_osd_client *osdc = lreq->osdc; in linger_registered()
2887 registered = __linger_registered(lreq); in linger_registered()
2893 static void linger_register(struct ceph_osd_linger_request *lreq) in linger_register() argument
2895 struct ceph_osd_client *osdc = lreq->osdc; in linger_register()
2898 WARN_ON(lreq->linger_id); in linger_register()
2900 linger_get(lreq); in linger_register()
2901 lreq->linger_id = ++osdc->last_linger_id; in linger_register()
2902 insert_linger_osdc(&osdc->linger_requests, lreq); in linger_register()
2905 static void linger_unregister(struct ceph_osd_linger_request *lreq) in linger_unregister() argument
2907 struct ceph_osd_client *osdc = lreq->osdc; in linger_unregister()
2911 erase_linger_osdc(&osdc->linger_requests, lreq); in linger_unregister()
2912 linger_put(lreq); in linger_unregister()
2917 struct ceph_osd_linger_request *lreq = req->r_priv; in cancel_linger_request() local
2921 linger_put(lreq); in cancel_linger_request()
2926 struct ceph_osd_linger_request *lreq; member
2945 static struct linger_work *lwork_alloc(struct ceph_osd_linger_request *lreq, in lwork_alloc() argument
2956 lwork->lreq = linger_get(lreq); in lwork_alloc()
2963 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_free() local
2965 mutex_lock(&lreq->lock); in lwork_free()
2967 mutex_unlock(&lreq->lock); in lwork_free()
2969 linger_put(lreq); in lwork_free()
2975 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_queue() local
2976 struct ceph_osd_client *osdc = lreq->osdc; in lwork_queue()
2978 verify_lreq_locked(lreq); in lwork_queue()
2982 list_add_tail(&lwork->pending_item, &lreq->pending_lworks); in lwork_queue()
2989 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_notify() local
2991 if (!linger_registered(lreq)) { in do_watch_notify()
2992 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_notify()
2996 WARN_ON(!lreq->is_watch); in do_watch_notify()
2997 dout("%s lreq %p notify_id %llu notifier_id %llu payload_len %zu\n", in do_watch_notify()
2998 __func__, lreq, lwork->notify.notify_id, lwork->notify.notifier_id, in do_watch_notify()
3000 lreq->wcb(lreq->data, lwork->notify.notify_id, lreq->linger_id, in do_watch_notify()
3012 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_error() local
3014 if (!linger_registered(lreq)) { in do_watch_error()
3015 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_error()
3019 dout("%s lreq %p err %d\n", __func__, lreq, lwork->error.err); in do_watch_error()
3020 lreq->errcb(lreq->data, lreq->linger_id, lwork->error.err); in do_watch_error()
3026 static void queue_watch_error(struct ceph_osd_linger_request *lreq) in queue_watch_error() argument
3030 lwork = lwork_alloc(lreq, do_watch_error); in queue_watch_error()
3036 lwork->error.err = lreq->last_error; in queue_watch_error()
3040 static void linger_reg_commit_complete(struct ceph_osd_linger_request *lreq, in linger_reg_commit_complete() argument
3043 if (!completion_done(&lreq->reg_commit_wait)) { in linger_reg_commit_complete()
3044 lreq->reg_commit_error = (result <= 0 ? result : 0); in linger_reg_commit_complete()
3045 complete_all(&lreq->reg_commit_wait); in linger_reg_commit_complete()
3051 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_commit_cb() local
3053 mutex_lock(&lreq->lock); in linger_commit_cb()
3054 if (req != lreq->reg_req) { in linger_commit_cb()
3055 dout("%s lreq %p linger_id %llu unknown req (%p != %p)\n", in linger_commit_cb()
3056 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_commit_cb()
3060 dout("%s lreq %p linger_id %llu result %d\n", __func__, lreq, in linger_commit_cb()
3061 lreq->linger_id, req->r_result); in linger_commit_cb()
3062 linger_reg_commit_complete(lreq, req->r_result); in linger_commit_cb()
3063 lreq->committed = true; in linger_commit_cb()
3065 if (!lreq->is_watch) { in linger_commit_cb()
3075 lreq->notify_id = ceph_decode_64(&p); in linger_commit_cb()
3076 dout("lreq %p notify_id %llu\n", lreq, in linger_commit_cb()
3077 lreq->notify_id); in linger_commit_cb()
3079 dout("lreq %p no notify_id\n", lreq); in linger_commit_cb()
3084 mutex_unlock(&lreq->lock); in linger_commit_cb()
3085 linger_put(lreq); in linger_commit_cb()
3103 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_reconnect_cb() local
3105 mutex_lock(&lreq->lock); in linger_reconnect_cb()
3106 if (req != lreq->reg_req) { in linger_reconnect_cb()
3107 dout("%s lreq %p linger_id %llu unknown req (%p != %p)\n", in linger_reconnect_cb()
3108 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_reconnect_cb()
3112 dout("%s lreq %p linger_id %llu result %d last_error %d\n", __func__, in linger_reconnect_cb()
3113 lreq, lreq->linger_id, req->r_result, lreq->last_error); in linger_reconnect_cb()
3115 if (!lreq->last_error) { in linger_reconnect_cb()
3116 lreq->last_error = normalize_watch_error(req->r_result); in linger_reconnect_cb()
3117 queue_watch_error(lreq); in linger_reconnect_cb()
3122 mutex_unlock(&lreq->lock); in linger_reconnect_cb()
3123 linger_put(lreq); in linger_reconnect_cb()
3126 static void send_linger(struct ceph_osd_linger_request *lreq) in send_linger() argument
3128 struct ceph_osd_client *osdc = lreq->osdc; in send_linger()
3133 mutex_lock(&lreq->lock); in send_linger()
3134 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in send_linger()
3136 if (lreq->reg_req) { in send_linger()
3137 if (lreq->reg_req->r_osd) in send_linger()
3138 cancel_linger_request(lreq->reg_req); in send_linger()
3139 ceph_osdc_put_request(lreq->reg_req); in send_linger()
3145 target_copy(&req->r_t, &lreq->t); in send_linger()
3146 req->r_mtime = lreq->mtime; in send_linger()
3148 if (lreq->is_watch && lreq->committed) { in send_linger()
3150 lreq->linger_id, ++lreq->register_gen); in send_linger()
3151 dout("lreq %p reconnect register_gen %u\n", lreq, in send_linger()
3155 if (lreq->is_watch) { in send_linger()
3157 lreq->linger_id, 0); in send_linger()
3159 lreq->notify_id = 0; in send_linger()
3161 refcount_inc(&lreq->request_pl->refcnt); in send_linger()
3162 osd_req_op_notify_init(req, 0, lreq->linger_id, in send_linger()
3163 lreq->request_pl); in send_linger()
3166 lreq->notify_id_pages, PAGE_SIZE, 0, false, false); in send_linger()
3168 dout("lreq %p register\n", lreq); in send_linger()
3175 req->r_priv = linger_get(lreq); in send_linger()
3177 lreq->reg_req = req; in send_linger()
3178 mutex_unlock(&lreq->lock); in send_linger()
3185 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_ping_cb() local
3187 mutex_lock(&lreq->lock); in linger_ping_cb()
3188 if (req != lreq->ping_req) { in linger_ping_cb()
3189 dout("%s lreq %p linger_id %llu unknown req (%p != %p)\n", in linger_ping_cb()
3190 __func__, lreq, lreq->linger_id, req, lreq->ping_req); in linger_ping_cb()
3194 dout("%s lreq %p linger_id %llu result %d ping_sent %lu last_error %d\n", in linger_ping_cb()
3195 __func__, lreq, lreq->linger_id, req->r_result, lreq->ping_sent, in linger_ping_cb()
3196 lreq->last_error); in linger_ping_cb()
3197 if (lreq->register_gen == req->r_ops[0].watch.gen) { in linger_ping_cb()
3199 lreq->watch_valid_thru = lreq->ping_sent; in linger_ping_cb()
3200 } else if (!lreq->last_error) { in linger_ping_cb()
3201 lreq->last_error = normalize_watch_error(req->r_result); in linger_ping_cb()
3202 queue_watch_error(lreq); in linger_ping_cb()
3205 dout("lreq %p register_gen %u ignoring old pong %u\n", lreq, in linger_ping_cb()
3206 lreq->register_gen, req->r_ops[0].watch.gen); in linger_ping_cb()
3210 mutex_unlock(&lreq->lock); in linger_ping_cb()
3211 linger_put(lreq); in linger_ping_cb()
3214 static void send_linger_ping(struct ceph_osd_linger_request *lreq) in send_linger_ping() argument
3216 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_ping()
3225 lreq->ping_sent = jiffies; in send_linger_ping()
3226 dout("%s lreq %p linger_id %llu ping_sent %lu register_gen %u\n", in send_linger_ping()
3227 __func__, lreq, lreq->linger_id, lreq->ping_sent, in send_linger_ping()
3228 lreq->register_gen); in send_linger_ping()
3230 if (lreq->ping_req) { in send_linger_ping()
3231 if (lreq->ping_req->r_osd) in send_linger_ping()
3232 cancel_linger_request(lreq->ping_req); in send_linger_ping()
3233 ceph_osdc_put_request(lreq->ping_req); in send_linger_ping()
3239 target_copy(&req->r_t, &lreq->t); in send_linger_ping()
3240 osd_req_op_watch_init(req, 0, CEPH_OSD_WATCH_OP_PING, lreq->linger_id, in send_linger_ping()
3241 lreq->register_gen); in send_linger_ping()
3247 req->r_priv = linger_get(lreq); in send_linger_ping()
3249 lreq->ping_req = req; in send_linger_ping()
3254 link_request(lreq->osd, req); in send_linger_ping()
3258 static void linger_submit(struct ceph_osd_linger_request *lreq) in linger_submit() argument
3260 struct ceph_osd_client *osdc = lreq->osdc; in linger_submit()
3264 linger_register(lreq); in linger_submit()
3266 calc_target(osdc, &lreq->t, false); in linger_submit()
3267 osd = lookup_create_osd(osdc, lreq->t.osd, true); in linger_submit()
3268 link_linger(osd, lreq); in linger_submit()
3270 send_linger(lreq); in linger_submit()
3274 static void cancel_linger_map_check(struct ceph_osd_linger_request *lreq) in cancel_linger_map_check() argument
3276 struct ceph_osd_client *osdc = lreq->osdc; in cancel_linger_map_check()
3282 lreq->linger_id); in cancel_linger_map_check()
3286 WARN_ON(lookup_lreq != lreq); in cancel_linger_map_check()
3287 erase_linger_mc(&osdc->linger_map_checks, lreq); in cancel_linger_map_check()
3288 linger_put(lreq); in cancel_linger_map_check()
3292 * @lreq has to be both registered and linked.
3294 static void __linger_cancel(struct ceph_osd_linger_request *lreq) in __linger_cancel() argument
3296 if (lreq->ping_req && lreq->ping_req->r_osd) in __linger_cancel()
3297 cancel_linger_request(lreq->ping_req); in __linger_cancel()
3298 if (lreq->reg_req && lreq->reg_req->r_osd) in __linger_cancel()
3299 cancel_linger_request(lreq->reg_req); in __linger_cancel()
3300 cancel_linger_map_check(lreq); in __linger_cancel()
3301 unlink_linger(lreq->osd, lreq); in __linger_cancel()
3302 linger_unregister(lreq); in __linger_cancel()
3305 static void linger_cancel(struct ceph_osd_linger_request *lreq) in linger_cancel() argument
3307 struct ceph_osd_client *osdc = lreq->osdc; in linger_cancel()
3310 if (__linger_registered(lreq)) in linger_cancel()
3311 __linger_cancel(lreq); in linger_cancel()
3315 static void send_linger_map_check(struct ceph_osd_linger_request *lreq);
3317 static void check_linger_pool_dne(struct ceph_osd_linger_request *lreq) in check_linger_pool_dne() argument
3319 struct ceph_osd_client *osdc = lreq->osdc; in check_linger_pool_dne()
3325 if (lreq->register_gen) { in check_linger_pool_dne()
3326 lreq->map_dne_bound = map->epoch; in check_linger_pool_dne()
3327 dout("%s lreq %p linger_id %llu pool disappeared\n", __func__, in check_linger_pool_dne()
3328 lreq, lreq->linger_id); in check_linger_pool_dne()
3330 dout("%s lreq %p linger_id %llu map_dne_bound %u have %u\n", in check_linger_pool_dne()
3331 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in check_linger_pool_dne()
3335 if (lreq->map_dne_bound) { in check_linger_pool_dne()
3336 if (map->epoch >= lreq->map_dne_bound) { in check_linger_pool_dne()
3339 lreq->linger_id); in check_linger_pool_dne()
3340 linger_reg_commit_complete(lreq, -ENOENT); in check_linger_pool_dne()
3341 __linger_cancel(lreq); in check_linger_pool_dne()
3344 send_linger_map_check(lreq); in check_linger_pool_dne()
3351 struct ceph_osd_linger_request *lreq; in linger_map_check_cb() local
3357 lreq = lookup_linger_mc(&osdc->linger_map_checks, linger_id); in linger_map_check_cb()
3358 if (!lreq) { in linger_map_check_cb()
3363 dout("%s lreq %p linger_id %llu map_dne_bound %u newest %llu\n", in linger_map_check_cb()
3364 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in linger_map_check_cb()
3366 if (!lreq->map_dne_bound) in linger_map_check_cb()
3367 lreq->map_dne_bound = greq->u.newest; in linger_map_check_cb()
3368 erase_linger_mc(&osdc->linger_map_checks, lreq); in linger_map_check_cb()
3369 check_linger_pool_dne(lreq); in linger_map_check_cb()
3371 linger_put(lreq); in linger_map_check_cb()
3376 static void send_linger_map_check(struct ceph_osd_linger_request *lreq) in send_linger_map_check() argument
3378 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_map_check()
3385 lreq->linger_id); in send_linger_map_check()
3387 WARN_ON(lookup_lreq != lreq); in send_linger_map_check()
3391 linger_get(lreq); in send_linger_map_check()
3392 insert_linger_mc(&osdc->linger_map_checks, lreq); in send_linger_map_check()
3394 linger_map_check_cb, lreq->linger_id); in send_linger_map_check()
3398 static int linger_reg_commit_wait(struct ceph_osd_linger_request *lreq) in linger_reg_commit_wait() argument
3402 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_reg_commit_wait()
3403 ret = wait_for_completion_killable(&lreq->reg_commit_wait); in linger_reg_commit_wait()
3404 return ret ?: lreq->reg_commit_error; in linger_reg_commit_wait()
3407 static int linger_notify_finish_wait(struct ceph_osd_linger_request *lreq, in linger_notify_finish_wait() argument
3412 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_notify_finish_wait()
3413 left = wait_for_completion_killable_timeout(&lreq->notify_finish_wait, in linger_notify_finish_wait()
3418 left = lreq->notify_finish_error; /* completed */ in linger_notify_finish_wait()
3470 struct ceph_osd_linger_request *lreq = in handle_timeout() local
3473 dout(" lreq %p linger_id %llu is served by osd%d\n", in handle_timeout()
3474 lreq, lreq->linger_id, osd->o_osd); in handle_timeout()
3477 mutex_lock(&lreq->lock); in handle_timeout()
3478 if (lreq->is_watch && lreq->committed && !lreq->last_error) in handle_timeout()
3479 send_linger_ping(lreq); in handle_timeout()
3480 mutex_unlock(&lreq->lock); in handle_timeout()
3905 recalc_linger_target(struct ceph_osd_linger_request *lreq) in recalc_linger_target() argument
3907 struct ceph_osd_client *osdc = lreq->osdc; in recalc_linger_target()
3910 ct_res = calc_target(osdc, &lreq->t, true); in recalc_linger_target()
3914 osd = lookup_create_osd(osdc, lreq->t.osd, true); in recalc_linger_target()
3915 if (osd != lreq->osd) { in recalc_linger_target()
3916 unlink_linger(lreq->osd, lreq); in recalc_linger_target()
3917 link_linger(osd, lreq); in recalc_linger_target()
3939 struct ceph_osd_linger_request *lreq = in scan_requests() local
3945 dout("%s lreq %p linger_id %llu\n", __func__, lreq, in scan_requests()
3946 lreq->linger_id); in scan_requests()
3947 ct_res = recalc_linger_target(lreq); in scan_requests()
3952 pool_cleared_full(osdc, lreq->t.base_oloc.pool)); in scan_requests()
3958 cancel_linger_map_check(lreq); in scan_requests()
3964 if (list_empty(&lreq->scan_item)) in scan_requests()
3965 list_add_tail(&lreq->scan_item, need_resend_linger); in scan_requests()
3968 list_del_init(&lreq->scan_item); in scan_requests()
3969 check_linger_pool_dne(lreq); in scan_requests()
4081 struct ceph_osd_linger_request *lreq, *nlreq; in kick_requests() local
4119 list_for_each_entry_safe(lreq, nlreq, need_resend_linger, scan_item) { in kick_requests()
4120 if (!osd_homeless(lreq->osd)) in kick_requests()
4121 send_linger(lreq); in kick_requests()
4123 list_del_init(&lreq->scan_item); in kick_requests()
4267 struct ceph_osd_linger_request *lreq = in kick_osd_requests() local
4270 send_linger(lreq); in kick_osd_requests()
4564 struct ceph_osd_linger_request *lreq; in handle_watch_notify() local
4593 lreq = lookup_linger_osdc(&osdc->linger_requests, cookie); in handle_watch_notify()
4594 if (!lreq) { in handle_watch_notify()
4600 mutex_lock(&lreq->lock); in handle_watch_notify()
4601 dout("%s opcode %d cookie %llu lreq %p is_watch %d\n", __func__, in handle_watch_notify()
4602 opcode, cookie, lreq, lreq->is_watch); in handle_watch_notify()
4604 if (!lreq->last_error) { in handle_watch_notify()
4605 lreq->last_error = -ENOTCONN; in handle_watch_notify()
4606 queue_watch_error(lreq); in handle_watch_notify()
4608 } else if (!lreq->is_watch) { in handle_watch_notify()
4610 if (lreq->notify_id && lreq->notify_id != notify_id) { in handle_watch_notify()
4611 dout("lreq %p notify_id %llu != %llu, ignoring\n", lreq, in handle_watch_notify()
4612 lreq->notify_id, notify_id); in handle_watch_notify()
4613 } else if (!completion_done(&lreq->notify_finish_wait)) { in handle_watch_notify()
4618 if (lreq->preply_pages) { in handle_watch_notify()
4621 *lreq->preply_pages = data->pages; in handle_watch_notify()
4622 *lreq->preply_len = data->length; in handle_watch_notify()
4626 lreq->notify_finish_error = return_code; in handle_watch_notify()
4627 complete_all(&lreq->notify_finish_wait); in handle_watch_notify()
4631 lwork = lwork_alloc(lreq, do_watch_notify); in handle_watch_notify()
4646 mutex_unlock(&lreq->lock); in handle_watch_notify()
4771 struct ceph_osd_linger_request *lreq; in ceph_osdc_watch() local
4774 lreq = linger_alloc(osdc); in ceph_osdc_watch()
4775 if (!lreq) in ceph_osdc_watch()
4778 lreq->is_watch = true; in ceph_osdc_watch()
4779 lreq->wcb = wcb; in ceph_osdc_watch()
4780 lreq->errcb = errcb; in ceph_osdc_watch()
4781 lreq->data = data; in ceph_osdc_watch()
4782 lreq->watch_valid_thru = jiffies; in ceph_osdc_watch()
4784 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_watch()
4785 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_watch()
4786 lreq->t.flags = CEPH_OSD_FLAG_WRITE; in ceph_osdc_watch()
4787 ktime_get_real_ts64(&lreq->mtime); in ceph_osdc_watch()
4789 linger_submit(lreq); in ceph_osdc_watch()
4790 ret = linger_reg_commit_wait(lreq); in ceph_osdc_watch()
4792 linger_cancel(lreq); in ceph_osdc_watch()
4796 return lreq; in ceph_osdc_watch()
4799 linger_put(lreq); in ceph_osdc_watch()
4812 struct ceph_osd_linger_request *lreq) in ceph_osdc_unwatch() argument
4822 ceph_oid_copy(&req->r_base_oid, &lreq->t.base_oid); in ceph_osdc_unwatch()
4823 ceph_oloc_copy(&req->r_base_oloc, &lreq->t.base_oloc); in ceph_osdc_unwatch()
4827 lreq->linger_id, 0); in ceph_osdc_unwatch()
4834 linger_cancel(lreq); in ceph_osdc_unwatch()
4835 linger_put(lreq); in ceph_osdc_unwatch()
4930 struct ceph_osd_linger_request *lreq; in ceph_osdc_notify() local
4939 lreq = linger_alloc(osdc); in ceph_osdc_notify()
4940 if (!lreq) in ceph_osdc_notify()
4943 lreq->request_pl = ceph_pagelist_alloc(GFP_NOIO); in ceph_osdc_notify()
4944 if (!lreq->request_pl) { in ceph_osdc_notify()
4949 ret = ceph_pagelist_encode_32(lreq->request_pl, 1); /* prot_ver */ in ceph_osdc_notify()
4950 ret |= ceph_pagelist_encode_32(lreq->request_pl, timeout); in ceph_osdc_notify()
4951 ret |= ceph_pagelist_encode_32(lreq->request_pl, payload_len); in ceph_osdc_notify()
4952 ret |= ceph_pagelist_append(lreq->request_pl, payload, payload_len); in ceph_osdc_notify()
4959 lreq->notify_id_pages = ceph_alloc_page_vector(1, GFP_NOIO); in ceph_osdc_notify()
4960 if (IS_ERR(lreq->notify_id_pages)) { in ceph_osdc_notify()
4961 ret = PTR_ERR(lreq->notify_id_pages); in ceph_osdc_notify()
4962 lreq->notify_id_pages = NULL; in ceph_osdc_notify()
4966 lreq->preply_pages = preply_pages; in ceph_osdc_notify()
4967 lreq->preply_len = preply_len; in ceph_osdc_notify()
4969 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_notify()
4970 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_notify()
4971 lreq->t.flags = CEPH_OSD_FLAG_READ; in ceph_osdc_notify()
4973 linger_submit(lreq); in ceph_osdc_notify()
4974 ret = linger_reg_commit_wait(lreq); in ceph_osdc_notify()
4976 ret = linger_notify_finish_wait(lreq, in ceph_osdc_notify()
4979 dout("lreq %p failed to initiate notify %d\n", lreq, ret); in ceph_osdc_notify()
4981 linger_cancel(lreq); in ceph_osdc_notify()
4983 linger_put(lreq); in ceph_osdc_notify()