Whamcloud - gitweb
LU-7318 out: dynamic reply size
[fs/lustre-release.git] / lustre / target / out_handler.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2013, 2015, Intel Corporation.
24  *
25  * lustre/target/out_handler.c
26  *
27  * Object update handler between targets.
28  *
29  * Author: di.wang <di.wang@intel.com>
30  */
31
32 #define DEBUG_SUBSYSTEM S_CLASS
33
34 #include <obd_class.h>
35 #include <md_object.h>
36 #include "tgt_internal.h"
37 #include <lustre_update.h>
38
39 static void out_reconstruct(const struct lu_env *env, struct dt_device *dt,
40                             struct dt_object *obj,
41                             struct object_update_reply *reply,
42                             int index)
43 {
44         CDEBUG(D_INFO, "%s: fork reply reply %p index %d: rc = %d\n",
45                dt_obd_name(dt), reply, index, 0);
46
47         object_update_result_insert(reply, NULL, 0, index, 0);
48         return;
49 }
50
51 typedef void (*out_reconstruct_t)(const struct lu_env *env,
52                                   struct dt_device *dt,
53                                   struct dt_object *obj,
54                                   struct object_update_reply *reply,
55                                   int index);
56
57 static inline int out_check_resent(const struct lu_env *env,
58                                    struct dt_device *dt,
59                                    struct dt_object *obj,
60                                    struct ptlrpc_request *req,
61                                    out_reconstruct_t reconstruct,
62                                    struct object_update_reply *reply,
63                                    int index)
64 {
65         if (likely(!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT)))
66                 return 0;
67
68         if (req_xid_is_last(req)) {
69                 struct lsd_client_data *lcd;
70
71                 /* XXX this does not support mulitple transactions yet, i.e.
72                  * only 1 update RPC each time betwee MDTs */
73                 lcd = req->rq_export->exp_target_data.ted_lcd;
74
75                 req->rq_transno = lcd->lcd_last_transno;
76                 req->rq_status = lcd->lcd_last_result;
77                 if (req->rq_status != 0)
78                         req->rq_transno = 0;
79                 lustre_msg_set_transno(req->rq_repmsg, req->rq_transno);
80                 lustre_msg_set_status(req->rq_repmsg, req->rq_status);
81
82                 DEBUG_REQ(D_RPCTRACE, req, "restoring transno "LPD64"status %d",
83                           req->rq_transno, req->rq_status);
84
85                 reconstruct(env, dt, obj, reply, index);
86                 return 1;
87         }
88         DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",
89                  req->rq_export->exp_target_data.ted_lcd->lcd_last_xid);
90         return 0;
91 }
92
93 static int out_create(struct tgt_session_info *tsi)
94 {
95         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
96         struct object_update    *update = tti->tti_u.update.tti_update;
97         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
98         struct dt_object_format *dof = &tti->tti_u.update.tti_update_dof;
99         struct obdo             *lobdo = &tti->tti_u.update.tti_obdo;
100         struct lu_attr          *attr = &tti->tti_attr;
101         struct lu_fid           *fid = NULL;
102         struct obdo             *wobdo;
103         size_t                  size;
104         int                     rc;
105
106         ENTRY;
107
108         wobdo = object_update_param_get(update, 0, &size);
109         if (wobdo == NULL || IS_ERR(wobdo) || size != sizeof(*wobdo)) {
110                 CERROR("%s: obdo is NULL, invalid RPC: rc = %d\n",
111                        tgt_name(tsi->tsi_tgt), -EPROTO);
112                 RETURN(err_serious(-EPROTO));
113         }
114
115         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
116                 lustre_swab_obdo(wobdo);
117         lustre_get_wire_obdo(NULL, lobdo, wobdo);
118         la_from_obdo(attr, lobdo, lobdo->o_valid);
119
120         dof->dof_type = dt_mode_to_dft(attr->la_mode);
121         if (update->ou_params_count > 1) {
122                 fid = object_update_param_get(update, 1, &size);
123                 if (fid == NULL || IS_ERR(fid) || size != sizeof(*fid)) {
124                         CERROR("%s: invalid fid: rc = %d\n",
125                                tgt_name(tsi->tsi_tgt), -EPROTO);
126                         RETURN(err_serious(-EPROTO));
127                 }
128                 if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
129                         lustre_swab_lu_fid(fid);
130                 if (!fid_is_sane(fid)) {
131                         CERROR("%s: invalid fid "DFID": rc = %d\n",
132                                tgt_name(tsi->tsi_tgt), PFID(fid), -EPROTO);
133                         RETURN(err_serious(-EPROTO));
134                 }
135         }
136
137         if (lu_object_exists(&obj->do_lu))
138                 RETURN(-EEXIST);
139
140         rc = out_tx_create(tsi->tsi_env, obj, attr, fid, dof,
141                            &tti->tti_tea, tti->tti_tea.ta_handle,
142                            tti->tti_u.update.tti_update_reply,
143                            tti->tti_u.update.tti_update_reply_index);
144
145         RETURN(rc);
146 }
147
148 static int out_attr_set(struct tgt_session_info *tsi)
149 {
150         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
151         struct object_update    *update = tti->tti_u.update.tti_update;
152         struct lu_attr          *attr = &tti->tti_attr;
153         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
154         struct obdo             *lobdo = &tti->tti_u.update.tti_obdo;
155         struct obdo             *wobdo;
156         size_t                   size;
157         int                      rc;
158
159         ENTRY;
160
161         wobdo = object_update_param_get(update, 0, &size);
162         if (wobdo == NULL || IS_ERR(wobdo) || size != sizeof(*wobdo)) {
163                 CERROR("%s: empty obdo in the update: rc = %d\n",
164                        tgt_name(tsi->tsi_tgt), -EPROTO);
165                 RETURN(err_serious(-EPROTO));
166         }
167
168         attr->la_valid = 0;
169         attr->la_valid = 0;
170
171         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
172                 lustre_swab_obdo(wobdo);
173         lustre_get_wire_obdo(NULL, lobdo, wobdo);
174         la_from_obdo(attr, lobdo, lobdo->o_valid);
175
176         rc = out_tx_attr_set(tsi->tsi_env, obj, attr, &tti->tti_tea,
177                              tti->tti_tea.ta_handle,
178                              tti->tti_u.update.tti_update_reply,
179                              tti->tti_u.update.tti_update_reply_index);
180
181         RETURN(rc);
182 }
183
184 static int out_attr_get(struct tgt_session_info *tsi)
185 {
186         const struct lu_env     *env = tsi->tsi_env;
187         struct tgt_thread_info  *tti = tgt_th_info(env);
188         struct object_update    *update = tti->tti_u.update.tti_update;
189         struct obdo             *obdo = &tti->tti_u.update.tti_obdo;
190         struct lu_attr          *la = &tti->tti_attr;
191         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
192         int                     idx = tti->tti_u.update.tti_update_reply_index;
193         int                     rc;
194
195         ENTRY;
196
197         if (unlikely(update->ou_result_size < sizeof(*obdo)))
198                 return -EPROTO;
199
200         if (!lu_object_exists(&obj->do_lu)) {
201                 /* Usually, this will be called when the master MDT try
202                  * to init a remote object(see osp_object_init), so if
203                  * the object does not exist on slave, we need set BANSHEE flag,
204                  * so the object can be removed from the cache immediately */
205                 set_bit(LU_OBJECT_HEARD_BANSHEE,
206                         &obj->do_lu.lo_header->loh_flags);
207                 RETURN(-ENOENT);
208         }
209
210         dt_read_lock(env, obj, MOR_TGT_CHILD);
211         rc = dt_attr_get(env, obj, la);
212         if (rc)
213                 GOTO(out_unlock, rc);
214
215         obdo->o_valid = 0;
216         obdo_from_la(obdo, la, la->la_valid);
217         lustre_set_wire_obdo(NULL, obdo, obdo);
218
219 out_unlock:
220         dt_read_unlock(env, obj);
221
222         CDEBUG(D_INFO, "%s: insert attr get reply %p index %d: rc = %d\n",
223                tgt_name(tsi->tsi_tgt), tti->tti_u.update.tti_update_reply,
224                0, rc);
225
226         object_update_result_insert(tti->tti_u.update.tti_update_reply, obdo,
227                                     sizeof(*obdo), idx, rc);
228
229         RETURN(rc);
230 }
231
232 static int out_xattr_get(struct tgt_session_info *tsi)
233 {
234         const struct lu_env        *env = tsi->tsi_env;
235         struct tgt_thread_info     *tti = tgt_th_info(env);
236         struct object_update       *update = tti->tti_u.update.tti_update;
237         struct lu_buf              *lbuf = &tti->tti_buf;
238         struct object_update_reply *reply = tti->tti_u.update.tti_update_reply;
239         struct dt_object           *obj = tti->tti_u.update.tti_dt_object;
240         char                       *name;
241         struct object_update_result *update_result;
242         int                     idx = tti->tti_u.update.tti_update_reply_index;
243         int                        rc;
244
245         ENTRY;
246
247         if (!lu_object_exists(&obj->do_lu)) {
248                 set_bit(LU_OBJECT_HEARD_BANSHEE,
249                         &obj->do_lu.lo_header->loh_flags);
250                 RETURN(-ENOENT);
251         }
252
253         name = object_update_param_get(update, 0, NULL);
254         if (name == NULL || IS_ERR(name)) {
255                 CERROR("%s: empty name for xattr get: rc = %d\n",
256                        tgt_name(tsi->tsi_tgt), -EPROTO);
257                 RETURN(err_serious(-EPROTO));
258         }
259
260         update_result = object_update_result_get(reply, 0, NULL);
261         if (update_result == NULL) {
262                 CERROR("%s: empty name for xattr get: rc = %d\n",
263                        tgt_name(tsi->tsi_tgt), -EPROTO);
264                 RETURN(err_serious(-EPROTO));
265         }
266
267         lbuf->lb_len = (int)tti->tti_u.update.tti_update->ou_result_size;
268         lbuf->lb_buf = update_result->our_data;
269         if (lbuf->lb_len == 0)
270                 lbuf->lb_buf = 0;
271         dt_read_lock(env, obj, MOR_TGT_CHILD);
272         rc = dt_xattr_get(env, obj, lbuf, name);
273         dt_read_unlock(env, obj);
274         if (rc < 0)
275                 lbuf->lb_len = 0;
276         CDEBUG(D_INFO, "%s: "DFID" get xattr %s len %d\n",
277                tgt_name(tsi->tsi_tgt), PFID(lu_object_fid(&obj->do_lu)),
278                name, (int)lbuf->lb_len);
279
280         GOTO(out, rc);
281
282 out:
283         object_update_result_insert(reply, lbuf->lb_buf, lbuf->lb_len, idx, rc);
284         RETURN(0);
285 }
286
287 static int out_index_lookup(struct tgt_session_info *tsi)
288 {
289         const struct lu_env     *env = tsi->tsi_env;
290         struct tgt_thread_info  *tti = tgt_th_info(env);
291         struct object_update    *update = tti->tti_u.update.tti_update;
292         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
293         char                    *name;
294         int                      rc;
295
296         ENTRY;
297
298         if (unlikely(update->ou_result_size < sizeof(tti->tti_fid1)))
299                 return -EPROTO;
300
301         if (!lu_object_exists(&obj->do_lu))
302                 RETURN(-ENOENT);
303
304         name = object_update_param_get(update, 0, NULL);
305         if (name == NULL || IS_ERR(name)) {
306                 CERROR("%s: empty name for lookup: rc = %d\n",
307                        tgt_name(tsi->tsi_tgt), -EPROTO);
308                 RETURN(err_serious(-EPROTO));
309         }
310
311         dt_read_lock(env, obj, MOR_TGT_CHILD);
312         if (!dt_try_as_dir(env, obj))
313                 GOTO(out_unlock, rc = -ENOTDIR);
314
315         rc = dt_lookup(env, obj, (struct dt_rec *)&tti->tti_fid1,
316                        (struct dt_key *)name);
317
318         if (rc < 0)
319                 GOTO(out_unlock, rc);
320
321         if (rc == 0)
322                 rc += 1;
323
324 out_unlock:
325         dt_read_unlock(env, obj);
326
327         CDEBUG(D_INFO, "lookup "DFID" %s get "DFID" rc %d\n",
328                PFID(lu_object_fid(&obj->do_lu)), name,
329                PFID(&tti->tti_fid1), rc);
330
331         CDEBUG(D_INFO, "%s: insert lookup reply %p index %d: rc = %d\n",
332                tgt_name(tsi->tsi_tgt), tti->tti_u.update.tti_update_reply,
333                0, rc);
334
335         object_update_result_insert(tti->tti_u.update.tti_update_reply,
336                             &tti->tti_fid1, sizeof(tti->tti_fid1),
337                             tti->tti_u.update.tti_update_reply_index, rc);
338         RETURN(rc);
339 }
340
341 static int out_xattr_set(struct tgt_session_info *tsi)
342 {
343         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
344         struct object_update    *update = tti->tti_u.update.tti_update;
345         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
346         struct lu_buf           *lbuf = &tti->tti_buf;
347         char                    *name;
348         char                    *buf;
349         __u32                   *tmp;
350         size_t                   buf_len = 0;
351         int                      flag;
352         size_t                   size = 0;
353         int                      rc;
354         ENTRY;
355
356         name = object_update_param_get(update, 0, NULL);
357         if (name == NULL || IS_ERR(name)) {
358                 CERROR("%s: empty name for xattr set: rc = %d\n",
359                        tgt_name(tsi->tsi_tgt), -EPROTO);
360                 RETURN(err_serious(-EPROTO));
361         }
362
363         buf = object_update_param_get(update, 1, &buf_len);
364         if (IS_ERR(buf))
365                 RETURN(err_serious(-EPROTO));
366
367         lbuf->lb_buf = buf;
368         lbuf->lb_len = buf_len;
369
370         tmp = object_update_param_get(update, 2, &size);
371         if (tmp == NULL || IS_ERR(tmp) || size != sizeof(*tmp)) {
372                 CERROR("%s: emptry or wrong size %zu flag: rc = %d\n",
373                        tgt_name(tsi->tsi_tgt), size, -EPROTO);
374                 RETURN(err_serious(-EPROTO));
375         }
376
377         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
378                 __swab32s(tmp);
379         flag = *tmp;
380
381         rc = out_tx_xattr_set(tsi->tsi_env, obj, lbuf, name, flag,
382                               &tti->tti_tea, tti->tti_tea.ta_handle,
383                               tti->tti_u.update.tti_update_reply,
384                               tti->tti_u.update.tti_update_reply_index);
385         RETURN(rc);
386 }
387
388 static int out_xattr_del(struct tgt_session_info *tsi)
389 {
390         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
391         struct object_update    *update = tti->tti_u.update.tti_update;
392         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
393         char                    *name;
394         int                      rc;
395         ENTRY;
396
397         name = object_update_param_get(update, 0, NULL);
398         if (name == NULL || IS_ERR(name)) {
399                 CERROR("%s: empty name for xattr set: rc = %d\n",
400                        tgt_name(tsi->tsi_tgt), -EPROTO);
401                 RETURN(err_serious(-EPROTO));
402         }
403
404         rc = out_tx_xattr_del(tsi->tsi_env, obj, name, &tti->tti_tea,
405                               tti->tti_tea.ta_handle,
406                               tti->tti_u.update.tti_update_reply,
407                               tti->tti_u.update.tti_update_reply_index);
408         RETURN(rc);
409 }
410
411 /**
412  * increase ref of the object
413  **/
414 static int out_ref_add(struct tgt_session_info *tsi)
415 {
416         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
417         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
418         int                      rc;
419
420         ENTRY;
421
422         rc = out_tx_ref_add(tsi->tsi_env, obj, &tti->tti_tea,
423                             tti->tti_tea.ta_handle,
424                             tti->tti_u.update.tti_update_reply,
425                             tti->tti_u.update.tti_update_reply_index);
426         RETURN(rc);
427 }
428
429 static int out_ref_del(struct tgt_session_info *tsi)
430 {
431         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
432         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
433         int                      rc;
434
435         ENTRY;
436
437         if (!lu_object_exists(&obj->do_lu))
438                 RETURN(-ENOENT);
439
440         rc = out_tx_ref_del(tsi->tsi_env, obj, &tti->tti_tea,
441                             tti->tti_tea.ta_handle,
442                             tti->tti_u.update.tti_update_reply,
443                             tti->tti_u.update.tti_update_reply_index);
444         RETURN(rc);
445 }
446
447 static int out_index_insert(struct tgt_session_info *tsi)
448 {
449         struct tgt_thread_info  *tti    = tgt_th_info(tsi->tsi_env);
450         struct object_update    *update = tti->tti_u.update.tti_update;
451         struct dt_object        *obj    = tti->tti_u.update.tti_dt_object;
452         struct dt_insert_rec    *rec    = &tti->tti_rec;
453         struct lu_fid           *fid;
454         char                    *name;
455         __u32                   *ptype;
456         int                      rc     = 0;
457         size_t                   size;
458         ENTRY;
459
460         name = object_update_param_get(update, 0, NULL);
461         if (name == NULL || IS_ERR(name)) {
462                 CERROR("%s: empty name for index insert: rc = %d\n",
463                        tgt_name(tsi->tsi_tgt), -EPROTO);
464                 RETURN(err_serious(-EPROTO));
465         }
466
467         fid = object_update_param_get(update, 1, &size);
468         if (fid == NULL || IS_ERR(fid) || size != sizeof(*fid)) {
469                 CERROR("%s: invalid fid: rc = %d\n",
470                        tgt_name(tsi->tsi_tgt), -EPROTO);
471                 RETURN(err_serious(-EPROTO));
472         }
473
474         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
475                 lustre_swab_lu_fid(fid);
476
477         if (!fid_is_sane(fid)) {
478                 CERROR("%s: invalid FID "DFID": rc = %d\n",
479                        tgt_name(tsi->tsi_tgt), PFID(fid), -EPROTO);
480                 RETURN(err_serious(-EPROTO));
481         }
482
483         ptype = object_update_param_get(update, 2, &size);
484         if (ptype == NULL || IS_ERR(ptype) || size != sizeof(*ptype)) {
485                 CERROR("%s: invalid type for index insert: rc = %d\n",
486                        tgt_name(tsi->tsi_tgt), -EPROTO);
487                 RETURN(err_serious(-EPROTO));
488         }
489
490         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
491                 __swab32s(ptype);
492
493         rec->rec_fid = fid;
494         rec->rec_type = *ptype;
495
496         rc = out_tx_index_insert(tsi->tsi_env, obj, (const struct dt_rec *)rec,
497                                  (const struct dt_key *)name, &tti->tti_tea,
498                                  tti->tti_tea.ta_handle,
499                                  tti->tti_u.update.tti_update_reply,
500                                  tti->tti_u.update.tti_update_reply_index);
501         RETURN(rc);
502 }
503
504 static int out_index_delete(struct tgt_session_info *tsi)
505 {
506         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
507         struct object_update    *update = tti->tti_u.update.tti_update;
508         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
509         char                    *name;
510         int                      rc = 0;
511
512         if (!lu_object_exists(&obj->do_lu))
513                 RETURN(-ENOENT);
514
515         name = object_update_param_get(update, 0, NULL);
516         if (name == NULL || IS_ERR(name)) {
517                 CERROR("%s: empty name for index delete: rc = %d\n",
518                        tgt_name(tsi->tsi_tgt), -EPROTO);
519                 RETURN(err_serious(-EPROTO));
520         }
521
522         rc = out_tx_index_delete(tsi->tsi_env, obj, (const struct dt_key *)name,
523                                  &tti->tti_tea, tti->tti_tea.ta_handle,
524                                  tti->tti_u.update.tti_update_reply,
525                                  tti->tti_u.update.tti_update_reply_index);
526         RETURN(rc);
527 }
528
529 static int out_destroy(struct tgt_session_info *tsi)
530 {
531         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
532         struct object_update    *update = tti->tti_u.update.tti_update;
533         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
534         struct lu_fid           *fid;
535         int                      rc;
536         ENTRY;
537
538         fid = &update->ou_fid;
539         if (!fid_is_sane(fid)) {
540                 CERROR("%s: invalid FID "DFID": rc = %d\n",
541                        tgt_name(tsi->tsi_tgt), PFID(fid), -EPROTO);
542                 RETURN(err_serious(-EPROTO));
543         }
544
545         if (!lu_object_exists(&obj->do_lu))
546                 RETURN(-ENOENT);
547
548         rc = out_tx_destroy(tsi->tsi_env, obj, &tti->tti_tea,
549                             tti->tti_tea.ta_handle,
550                             tti->tti_u.update.tti_update_reply,
551                             tti->tti_u.update.tti_update_reply_index);
552
553         RETURN(rc);
554 }
555
556 static int out_write(struct tgt_session_info *tsi)
557 {
558         struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
559         struct object_update    *update = tti->tti_u.update.tti_update;
560         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
561         struct lu_buf           *lbuf = &tti->tti_buf;
562         char                    *buf;
563         __u64                   *tmp;
564         size_t                  size = 0;
565         size_t                  buf_len = 0;
566         loff_t                  pos;
567         int                      rc;
568         ENTRY;
569
570         buf = object_update_param_get(update, 0, &buf_len);
571         if (buf == NULL || IS_ERR(buf) || buf_len == 0) {
572                 CERROR("%s: empty buf for xattr set: rc = %d\n",
573                        tgt_name(tsi->tsi_tgt), -EPROTO);
574                 RETURN(err_serious(-EPROTO));
575         }
576         lbuf->lb_buf = buf;
577         lbuf->lb_len = buf_len;
578
579         tmp = object_update_param_get(update, 1, &size);
580         if (tmp == NULL || IS_ERR(tmp) || size != sizeof(*tmp)) {
581                 CERROR("%s: empty or wrong size %zu pos: rc = %d\n",
582                        tgt_name(tsi->tsi_tgt), size, -EPROTO);
583                 RETURN(err_serious(-EPROTO));
584         }
585
586         if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
587                 __swab64s(tmp);
588         pos = *tmp;
589
590         rc = out_tx_write(tsi->tsi_env, obj, lbuf, pos,
591                           &tti->tti_tea, tti->tti_tea.ta_handle,
592                           tti->tti_u.update.tti_update_reply,
593                           tti->tti_u.update.tti_update_reply_index);
594         RETURN(rc);
595 }
596
597 static int out_read(struct tgt_session_info *tsi)
598 {
599         const struct lu_env     *env = tsi->tsi_env;
600         struct tgt_thread_info  *tti = tgt_th_info(env);
601         struct object_update    *update = tti->tti_u.update.tti_update;
602         struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
603         struct object_update_reply *reply = tti->tti_u.update.tti_update_reply;
604         int index = tti->tti_u.update.tti_update_reply_index;
605         struct lu_rdbuf *rdbuf;
606         struct object_update_result *update_result;
607         struct out_read_reply   *orr;
608         void *tmp;
609         size_t size;
610         size_t total_size = 0;
611         __u64 pos;
612         unsigned int i;
613         unsigned int nbufs;
614         int rc = 0;
615         ENTRY;
616
617         update_result = object_update_result_get(reply, index, NULL);
618         LASSERT(update_result != NULL);
619         update_result->our_datalen = sizeof(*orr);
620
621         if (!lu_object_exists(&obj->do_lu))
622                 GOTO(out, rc = -ENOENT);
623
624         tmp = object_update_param_get(update, 0, NULL);
625         if (tmp == NULL || IS_ERR(tmp)) {
626                 CERROR("%s: empty size for read: rc = %d\n",
627                        tgt_name(tsi->tsi_tgt), -EPROTO);
628                 GOTO(out, rc = err_serious(-EPROTO));
629         }
630         size = le64_to_cpu(*(size_t *)(tmp));
631
632         tmp = object_update_param_get(update, 1, NULL);
633         if (tmp == NULL || IS_ERR(tmp)) {
634                 CERROR("%s: empty pos for read: rc = %d\n",
635                        tgt_name(tsi->tsi_tgt), -EPROTO);
636                 GOTO(out, rc = err_serious(-EPROTO));
637         }
638         pos = le64_to_cpu(*(__u64 *)(tmp));
639
640         /* Put the offset into the begining of the buffer in reply */
641         orr = (struct out_read_reply *)update_result->our_data;
642
643         nbufs = (size + OUT_BULK_BUFFER_SIZE - 1) / OUT_BULK_BUFFER_SIZE;
644         OBD_ALLOC(rdbuf, sizeof(struct lu_rdbuf) +
645                          nbufs * sizeof(rdbuf->rb_bufs[0]));
646         if (rdbuf == NULL)
647                 GOTO(out, rc = -ENOMEM);
648
649         rdbuf->rb_nbufs = 0;
650         total_size = 0;
651         for (i = 0; i < nbufs; i++) {
652                 __u32 read_size;
653
654                 read_size = size > OUT_BULK_BUFFER_SIZE ?
655                             OUT_BULK_BUFFER_SIZE : size;
656                 OBD_ALLOC(rdbuf->rb_bufs[i].lb_buf, read_size);
657                 if (rdbuf->rb_bufs[i].lb_buf == NULL)
658                         GOTO(out_free, rc = -ENOMEM);
659
660                 rdbuf->rb_bufs[i].lb_len = read_size;
661                 dt_read_lock(env, obj, MOR_TGT_CHILD);
662                 rc = dt_read(env, obj, &rdbuf->rb_bufs[i], &pos);
663                 dt_read_unlock(env, obj);
664
665                 total_size += rc < 0 ? 0 : rc;
666                 if (rc <= 0)
667                         break;
668
669                 rdbuf->rb_nbufs++;
670                 size -= read_size;
671         }
672
673         /* send pages to client */
674         rc = tgt_send_buffer(tsi, rdbuf);
675         if (rc < 0)
676                 GOTO(out_free, rc);
677
678         orr->orr_size = total_size;
679         orr->orr_offset = pos;
680
681         orr_cpu_to_le(orr, orr);
682         update_result->our_datalen += orr->orr_size;
683 out_free:
684         for (i = 0; i < nbufs; i++) {
685                 if (rdbuf->rb_bufs[i].lb_buf != NULL) {
686                         OBD_FREE(rdbuf->rb_bufs[i].lb_buf,
687                                  rdbuf->rb_bufs[i].lb_len);
688                 }
689         }
690         OBD_FREE(rdbuf, sizeof(struct lu_rdbuf) +
691                         nbufs * sizeof(rdbuf->rb_bufs[0]));
692 out:
693         /* Insert read buffer */
694         update_result->our_rc = ptlrpc_status_hton(rc);
695         reply->ourp_lens[index] = cfs_size_round(update_result->our_datalen +
696                                                  sizeof(*update_result));
697         RETURN(rc);
698 }
699
700 static int out_noop(struct tgt_session_info *tsi)
701 {
702         return 0;
703 }
704
705 #define DEF_OUT_HNDL(opc, name, flags, fn)     \
706 [opc - OUT_CREATE] = {                                  \
707         .th_name    = name,                             \
708         .th_fail_id = 0,                                \
709         .th_opc     = opc,                              \
710         .th_flags   = flags,                            \
711         .th_act     = fn,                               \
712         .th_fmt     = NULL,                             \
713         .th_version = 0,                                \
714 }
715
716 static struct tgt_handler out_update_ops[] = {
717         DEF_OUT_HNDL(OUT_CREATE, "out_create", MUTABOR | HABEO_REFERO,
718                      out_create),
719         DEF_OUT_HNDL(OUT_DESTROY, "out_create", MUTABOR | HABEO_REFERO,
720                      out_destroy),
721         DEF_OUT_HNDL(OUT_REF_ADD, "out_ref_add", MUTABOR | HABEO_REFERO,
722                      out_ref_add),
723         DEF_OUT_HNDL(OUT_REF_DEL, "out_ref_del", MUTABOR | HABEO_REFERO,
724                      out_ref_del),
725         DEF_OUT_HNDL(OUT_ATTR_SET, "out_attr_set",  MUTABOR | HABEO_REFERO,
726                      out_attr_set),
727         DEF_OUT_HNDL(OUT_ATTR_GET, "out_attr_get",  HABEO_REFERO,
728                      out_attr_get),
729         DEF_OUT_HNDL(OUT_XATTR_SET, "out_xattr_set", MUTABOR | HABEO_REFERO,
730                      out_xattr_set),
731         DEF_OUT_HNDL(OUT_XATTR_DEL, "out_xattr_del", MUTABOR | HABEO_REFERO,
732                      out_xattr_del),
733         DEF_OUT_HNDL(OUT_XATTR_GET, "out_xattr_get", HABEO_REFERO,
734                      out_xattr_get),
735         DEF_OUT_HNDL(OUT_INDEX_LOOKUP, "out_index_lookup", HABEO_REFERO,
736                      out_index_lookup),
737         DEF_OUT_HNDL(OUT_INDEX_INSERT, "out_index_insert",
738                      MUTABOR | HABEO_REFERO, out_index_insert),
739         DEF_OUT_HNDL(OUT_INDEX_DELETE, "out_index_delete",
740                      MUTABOR | HABEO_REFERO, out_index_delete),
741         DEF_OUT_HNDL(OUT_WRITE, "out_write", MUTABOR | HABEO_REFERO, out_write),
742         DEF_OUT_HNDL(OUT_READ, "out_read", HABEO_REFERO, out_read),
743         DEF_OUT_HNDL(OUT_NOOP, "out_noop", HABEO_REFERO, out_noop),
744 };
745
746 static struct tgt_handler *out_handler_find(__u32 opc)
747 {
748         struct tgt_handler *h;
749
750         h = NULL;
751         if (OUT_CREATE <= opc && opc < OUT_LAST) {
752                 h = &out_update_ops[opc - OUT_CREATE];
753                 LASSERTF(h->th_opc == opc, "opcode mismatch %d != %d\n",
754                          h->th_opc, opc);
755         } else {
756                 h = NULL; /* unsupported opc */
757         }
758         return h;
759 }
760
761 static int out_tx_start(const struct lu_env *env, struct dt_device *dt,
762                         struct thandle_exec_args *ta, struct obd_export *exp)
763 {
764         ta->ta_argno = 0;
765         ta->ta_handle = dt_trans_create(env, dt);
766         if (IS_ERR(ta->ta_handle)) {
767                 int rc;
768
769                 rc = PTR_ERR(ta->ta_handle);
770                 ta->ta_handle = NULL;
771                 CERROR("%s: start handle error: rc = %d\n", dt_obd_name(dt),
772                        rc);
773                 return rc;
774         }
775         if (exp->exp_need_sync)
776                 ta->ta_handle->th_sync = 1;
777
778         return 0;
779 }
780
781 static int out_trans_start(const struct lu_env *env,
782                            struct thandle_exec_args *ta)
783 {
784         return dt_trans_start(env, ta->ta_handle->th_dev, ta->ta_handle);
785 }
786
787 static int out_trans_stop(const struct lu_env *env,
788                           struct thandle_exec_args *ta, int err)
789 {
790         int i;
791         int rc;
792
793         ta->ta_handle->th_result = err;
794         rc = dt_trans_stop(env, ta->ta_handle->th_dev, ta->ta_handle);
795         for (i = 0; i < ta->ta_argno; i++) {
796                 if (ta->ta_args[i]->object != NULL) {
797                         struct dt_object *obj = ta->ta_args[i]->object;
798
799                         /* If the object is being created during this
800                          * transaction, we need to remove them from the
801                          * cache immediately, because a few layers are
802                          * missing in OUT handler, i.e. the object might
803                          * not be initialized in all layers */
804                         if (ta->ta_args[i]->exec_fn == out_tx_create_exec)
805                                 set_bit(LU_OBJECT_HEARD_BANSHEE,
806                                         &obj->do_lu.lo_header->loh_flags);
807                         lu_object_put(env, &ta->ta_args[i]->object->do_lu);
808                         ta->ta_args[i]->object = NULL;
809                 }
810         }
811         ta->ta_handle = NULL;
812         ta->ta_argno = 0;
813
814         return rc;
815 }
816
817 static int out_tx_end(const struct lu_env *env, struct thandle_exec_args *ta,
818                       int declare_ret)
819 {
820         struct tgt_session_info *tsi = tgt_ses_info(env);
821         int                     i;
822         int                     rc;
823         int                     rc1;
824         ENTRY;
825
826         if (ta->ta_handle == NULL)
827                 RETURN(0);
828
829         if (declare_ret != 0 || ta->ta_argno == 0)
830                 GOTO(stop, rc = declare_ret);
831
832         LASSERT(ta->ta_handle->th_dev != NULL);
833         rc = out_trans_start(env, ta);
834         if (unlikely(rc != 0))
835                 GOTO(stop, rc);
836
837         for (i = 0; i < ta->ta_argno; i++) {
838                 rc = ta->ta_args[i]->exec_fn(env, ta->ta_handle,
839                                              ta->ta_args[i]);
840                 if (unlikely(rc != 0)) {
841                         CDEBUG(D_INFO, "error during execution of #%u from"
842                                " %s:%d: rc = %d\n", i, ta->ta_args[i]->file,
843                                ta->ta_args[i]->line, rc);
844                         while (--i >= 0) {
845                                 if (ta->ta_args[i]->undo_fn != NULL)
846                                         ta->ta_args[i]->undo_fn(env,
847                                                                ta->ta_handle,
848                                                                ta->ta_args[i]);
849                                 else
850                                         CERROR("%s: undo for %s:%d: rc = %d\n",
851                                              dt_obd_name(ta->ta_handle->th_dev),
852                                                ta->ta_args[i]->file,
853                                                ta->ta_args[i]->line, -ENOTSUPP);
854                         }
855                         break;
856                 }
857                 CDEBUG(D_INFO, "%s: executed %u/%u: rc = %d\n",
858                        dt_obd_name(ta->ta_handle->th_dev), i, ta->ta_argno, rc);
859         }
860
861         /* Only fail for real updates, XXX right now llog updates will be
862         * ignore, whose updates count is usually 1, so failover test
863         * case will spot this FAIL_UPDATE_NET_REP precisely, and it will
864         * be removed after async update patch is landed. */
865         if (ta->ta_argno > 1)
866                 tsi->tsi_reply_fail_id = OBD_FAIL_OUT_UPDATE_NET_REP;
867
868 stop:
869         rc1 = out_trans_stop(env, ta, rc);
870         if (rc == 0)
871                 rc = rc1;
872
873         ta->ta_handle = NULL;
874         ta->ta_argno = 0;
875
876         RETURN(rc);
877 }
878
879 /**
880  * Object updates between Targets. Because all the updates has been
881  * dis-assemblied into object updates at sender side, so OUT will
882  * call OSD API directly to execute these updates.
883  *
884  * In DNE phase I all of the updates in the request need to be executed
885  * in one transaction, and the transaction has to be synchronously.
886  *
887  * Please refer to lustre/include/lustre/lustre_idl.h for req/reply
888  * format.
889  */
890 int out_handle(struct tgt_session_info *tsi)
891 {
892         const struct lu_env             *env = tsi->tsi_env;
893         struct tgt_thread_info          *tti = tgt_th_info(env);
894         struct thandle_exec_args        *ta = &tti->tti_tea;
895         struct req_capsule              *pill = tsi->tsi_pill;
896         struct dt_device                *dt = tsi->tsi_tgt->lut_bottom;
897         struct out_update_header        *ouh;
898         struct out_update_buffer        *oub = NULL;
899         struct object_update            *update;
900         struct object_update_reply      *reply;
901         struct ptlrpc_bulk_desc         *desc = NULL;
902         struct l_wait_info              lwi;
903         void                            **update_bufs;
904         int                             current_batchid = -1;
905         __u32                           update_buf_count;
906         unsigned int                    i;
907         unsigned int                    reply_index = 0;
908         int                             rc = 0;
909         int                             rc1 = 0;
910         int                             ouh_size, reply_size;
911         int                             updates;
912         ENTRY;
913
914         req_capsule_set(pill, &RQF_OUT_UPDATE);
915         ouh_size = req_capsule_get_size(pill, &RMF_OUT_UPDATE_HEADER,
916                                         RCL_CLIENT);
917         if (ouh_size <= 0)
918                 RETURN(err_serious(-EPROTO));
919
920         ouh = req_capsule_client_get(pill, &RMF_OUT_UPDATE_HEADER);
921         if (ouh == NULL)
922                 RETURN(err_serious(-EPROTO));
923
924         if (ouh->ouh_magic != OUT_UPDATE_HEADER_MAGIC) {
925                 CERROR("%s: invalid update buffer magic %x expect %x: "
926                        "rc = %d\n", tgt_name(tsi->tsi_tgt), ouh->ouh_magic,
927                        UPDATE_REQUEST_MAGIC, -EPROTO);
928                 RETURN(err_serious(-EPROTO));
929         }
930
931         update_buf_count = ouh->ouh_count;
932         if (update_buf_count == 0)
933                 RETURN(err_serious(-EPROTO));
934
935         OBD_ALLOC(update_bufs, sizeof(*update_bufs) * update_buf_count);
936         if (update_bufs == NULL)
937                 RETURN(-ENOMEM);
938
939         if (ouh->ouh_inline_length > 0) {
940                 update_bufs[0] = ouh->ouh_inline_data;
941         } else {
942                 struct out_update_buffer *tmp;
943
944                 oub = req_capsule_client_get(pill, &RMF_OUT_UPDATE_BUF);
945                 if (oub == NULL)
946                         GOTO(out_free, rc = -EPROTO);
947
948                 desc = ptlrpc_prep_bulk_exp(pill->rc_req, update_buf_count,
949                                             PTLRPC_BULK_OPS_COUNT,
950                                             PTLRPC_BULK_GET_SINK |
951                                             PTLRPC_BULK_BUF_KVEC,
952                                             MDS_BULK_PORTAL,
953                                             &ptlrpc_bulk_kvec_ops);
954                 if (desc == NULL)
955                         GOTO(out_free, rc = -ENOMEM);
956
957                 tmp = oub;
958                 for (i = 0; i < update_buf_count; i++, tmp++) {
959                         if (tmp->oub_size >= OUT_MAXREQSIZE)
960                                 GOTO(out_free, rc = -EPROTO);
961
962                         OBD_ALLOC(update_bufs[i], tmp->oub_size);
963                         if (update_bufs[i] == NULL)
964                                 GOTO(out_free, rc = -ENOMEM);
965
966                         desc->bd_frag_ops->add_iov_frag(desc, update_bufs[i],
967                                                         tmp->oub_size);
968                 }
969
970                 pill->rc_req->rq_bulk_write = 1;
971                 rc = sptlrpc_svc_prep_bulk(pill->rc_req, desc);
972                 if (rc != 0)
973                         GOTO(out_free, rc);
974
975                 rc = target_bulk_io(pill->rc_req->rq_export, desc, &lwi);
976                 if (rc < 0)
977                         GOTO(out_free, rc);
978         }
979         /* validate the request and calculate the total update count and
980          * set it to reply */
981         reply_size = 0;
982         updates = 0;
983         for (i = 0; i < update_buf_count; i++) {
984                 struct object_update_request    *our;
985                 int                              j;
986
987                 our = update_bufs[i];
988                 if (ptlrpc_req_need_swab(pill->rc_req))
989                         lustre_swab_object_update_request(our);
990
991                 if (our->ourq_magic != UPDATE_REQUEST_MAGIC) {
992                         CERROR("%s: invalid update buffer magic %x"
993                                " expect %x: rc = %d\n",
994                                tgt_name(tsi->tsi_tgt), our->ourq_magic,
995                                UPDATE_REQUEST_MAGIC, -EPROTO);
996                         GOTO(out_free, rc = -EPROTO);
997                 }
998                 updates += our->ourq_count;
999
1000                 /* need to calculate reply size */
1001                 for (j = 0; j < our->ourq_count; j++) {
1002                         update = object_update_request_get(our, j, NULL);
1003                         if (update == NULL)
1004                                 GOTO(out, rc = -EPROTO);
1005                         if (ptlrpc_req_need_swab(pill->rc_req))
1006                                 lustre_swab_object_update(update);
1007
1008                         if (!fid_is_sane(&update->ou_fid)) {
1009                                 CERROR("%s: invalid FID "DFID": rc = %d\n",
1010                                        tgt_name(tsi->tsi_tgt),
1011                                        PFID(&update->ou_fid), -EPROTO);
1012                                 GOTO(out, rc = err_serious(-EPROTO));
1013                         }
1014
1015                         /* XXX: what ou_result_size can be considered safe? */
1016
1017                         reply_size += sizeof(reply->ourp_lens[0]);
1018                         reply_size += sizeof(struct object_update_result);
1019                         reply_size += update->ou_result_size;
1020                 }
1021         }
1022         reply_size += sizeof(*reply);
1023
1024         if (unlikely(reply_size > ouh->ouh_reply_size)) {
1025                 CERROR("%s: too small reply buf %u for %u, need %u at least\n",
1026                        tgt_name(tsi->tsi_tgt), ouh->ouh_reply_size,
1027                        updates, reply_size);
1028                 GOTO(out_free, rc = -EPROTO);
1029         }
1030
1031         req_capsule_set_size(pill, &RMF_OUT_UPDATE_REPLY, RCL_SERVER,
1032                              ouh->ouh_reply_size);
1033         rc = req_capsule_server_pack(pill);
1034         if (rc != 0) {
1035                 CERROR("%s: Can't pack response: rc = %d\n",
1036                        tgt_name(tsi->tsi_tgt), rc);
1037                 GOTO(out_free, rc = -EPROTO);
1038         }
1039
1040         /* Prepare the update reply buffer */
1041         reply = req_capsule_server_get(pill, &RMF_OUT_UPDATE_REPLY);
1042         if (reply == NULL)
1043                 GOTO(out_free, rc = err_serious(-EPROTO));
1044         reply->ourp_magic = UPDATE_REPLY_MAGIC;
1045         reply->ourp_count = updates;
1046         tti->tti_u.update.tti_update_reply = reply;
1047         tti->tti_mult_trans = !req_is_replay(tgt_ses_req(tsi));
1048  
1049         /* Walk through updates in the request to execute them */
1050         for (i = 0; i < update_buf_count; i++) {
1051                 struct tgt_handler      *h;
1052                 struct dt_object        *dt_obj;
1053                 int                     update_count;
1054                 struct object_update_request *our;
1055                 int                     j;
1056
1057                 our = update_bufs[i];
1058                 update_count = our->ourq_count;
1059                 for (j = 0; j < update_count; j++) {
1060                         update = object_update_request_get(our, j, NULL);
1061
1062                         dt_obj = dt_locate(env, dt, &update->ou_fid);
1063                         if (IS_ERR(dt_obj))
1064                                 GOTO(out, rc = PTR_ERR(dt_obj));
1065
1066                         if (dt->dd_record_fid_accessed) {
1067                                 lfsck_pack_rfa(&tti->tti_lr,
1068                                                lu_object_fid(&dt_obj->do_lu),
1069                                                LE_FID_ACCESSED,
1070                                                LFSCK_TYPE_LAYOUT);
1071                                 tgt_lfsck_in_notify(env, dt, &tti->tti_lr,
1072                                                     NULL);
1073                         }
1074
1075                         tti->tti_u.update.tti_dt_object = dt_obj;
1076                         tti->tti_u.update.tti_update = update;
1077                         tti->tti_u.update.tti_update_reply_index = reply_index;
1078
1079                         h = out_handler_find(update->ou_type);
1080                         if (unlikely(h == NULL)) {
1081                                 CERROR("%s: unsupported opc: 0x%x\n",
1082                                        tgt_name(tsi->tsi_tgt), update->ou_type);
1083                                 GOTO(next, rc = -ENOTSUPP);
1084                         }
1085
1086                         /* Check resend case only for modifying RPC */
1087                         if (h->th_flags & MUTABOR) {
1088                                 struct ptlrpc_request *req = tgt_ses_req(tsi);
1089
1090                                 if (out_check_resent(env, dt, dt_obj, req,
1091                                                      out_reconstruct, reply,
1092                                                      reply_index))
1093                                         GOTO(next, rc = 0);
1094                         }
1095
1096                         /* start transaction for modification RPC only */
1097                         if (h->th_flags & MUTABOR && current_batchid == -1) {
1098                                 current_batchid = update->ou_batchid;
1099                                 rc = out_tx_start(env, dt, ta, tsi->tsi_exp);
1100                                 if (rc != 0)
1101                                         GOTO(next, rc);
1102
1103                                 if (update->ou_flags & UPDATE_FL_SYNC)
1104                                         ta->ta_handle->th_sync = 1;
1105                         }
1106
1107                         /* Stop the current update transaction, if the update
1108                          * has different batchid, or read-only update */
1109                         if (((current_batchid != update->ou_batchid) ||
1110                              !(h->th_flags & MUTABOR)) &&
1111                              ta->ta_handle != NULL) {
1112                                 rc = out_tx_end(env, ta, rc);
1113                                 current_batchid = -1;
1114                                 if (rc != 0)
1115                                         GOTO(next, rc);
1116
1117                                 /* start a new transaction if needed */
1118                                 if (h->th_flags & MUTABOR) {
1119                                         rc = out_tx_start(env, dt, ta,
1120                                                           tsi->tsi_exp);
1121                                         if (rc != 0)
1122                                                 GOTO(next, rc);
1123                                         if (update->ou_flags & UPDATE_FL_SYNC)
1124                                                 ta->ta_handle->th_sync = 1;
1125                                         current_batchid = update->ou_batchid;
1126                                 }
1127                         }
1128
1129                         rc = h->th_act(tsi);
1130 next:
1131                         reply_index++;
1132                         lu_object_put(env, &dt_obj->do_lu);
1133                         if (rc < 0)
1134                                 GOTO(out, rc);
1135                 }
1136         }
1137 out:
1138         if (current_batchid != -1) {
1139                 rc1 = out_tx_end(env, ta, rc);
1140                 if (rc == 0)
1141                         rc = rc1;
1142         }
1143
1144 out_free:
1145         if (update_bufs != NULL) {
1146                 if (oub != NULL) {
1147                         for (i = 0; i < update_buf_count; i++, oub++) {
1148                                 if (update_bufs[i] != NULL)
1149                                         OBD_FREE(update_bufs[i], oub->oub_size);
1150                         }
1151                 }
1152
1153                 OBD_FREE(update_bufs, sizeof(*update_bufs) * update_buf_count);
1154         }
1155
1156         if (desc != NULL)
1157                 ptlrpc_free_bulk(desc);
1158
1159         RETURN(rc);
1160 }
1161
1162 struct tgt_handler tgt_out_handlers[] = {
1163 TGT_UPDATE_HDL(MUTABOR, OUT_UPDATE,     out_handle),
1164 };
1165 EXPORT_SYMBOL(tgt_out_handlers);
1166