1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001-2004 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.sf.net/projects/lustre/
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # define EXPORT_SYMTAB
25 #define DEBUG_SUBSYSTEM S_MDC
28 # include <linux/module.h>
29 # include <linux/pagemap.h>
30 # include <linux/miscdevice.h>
31 # include <linux/init.h>
33 # include <liblustre.h>
36 #include <linux/obd_class.h>
37 #include <linux/lustre_mds.h>
38 #include <linux/lustre_dlm.h>
39 #include <linux/lustre_sec.h>
40 #include <linux/lprocfs_status.h>
41 #include <linux/lustre_acl.h>
42 #include "mdc_internal.h"
44 #define REQUEST_MINOR 244
46 static int mdc_cleanup(struct obd_device *obd, int flags);
48 extern int mds_queue_req(struct ptlrpc_request *);
49 /* Helper that implements most of mdc_getstatus and signal_completed_replay. */
50 /* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
51 static int send_getstatus(struct obd_import *imp, struct lustre_id *rootid,
52 int level, int msg_flags)
54 struct ptlrpc_request *req;
55 struct mds_body *body;
56 int rc, size[2] = {0, sizeof(*body)};
59 //size[0] = lustre_secdesc_size();
61 req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_GETSTATUS,
64 GOTO(out, rc = -ENOMEM);
66 //lustre_pack_secdesc(req, size[0]);
68 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
69 req->rq_send_state = level;
70 req->rq_replen = lustre_msg_size(1, &size[1]);
72 req->rq_reqmsg->flags |= msg_flags;
73 rc = ptlrpc_queue_wait(req);
76 body = lustre_swab_repbuf (req, 0, sizeof (*body),
77 lustre_swab_mds_body);
79 CERROR ("Can't extract mds_body\n");
80 GOTO (out, rc = -EPROTO);
83 memcpy(rootid, &body->id1, sizeof(*rootid));
85 CDEBUG(D_NET, "root ino="LPU64", last_committed="LPU64
86 ", last_xid="LPU64"\n", rootid->li_stc.u.e3s.l3s_ino,
87 req->rq_repmsg->last_committed, req->rq_repmsg->last_xid);
92 ptlrpc_req_finished(req);
96 /* This should be mdc_get_info("rootid") */
97 int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid)
99 return send_getstatus(class_exp2cliimp(exp), rootid,
103 int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
104 struct ptlrpc_request *req)
106 struct mds_body *body, *reqbody;
109 int repsize[4] = {sizeof(*body)};
113 /* request message already built */
116 repsize[bufcount++] = ea_size;
117 CDEBUG(D_INODE, "reserved %u bytes for MD/symlink in packet\n",
121 reqbody = lustre_msg_buf(req->rq_reqmsg, 1, sizeof(*reqbody));
123 if (reqbody->valid & OBD_MD_FLACL_ACCESS) {
124 repsize[bufcount++] = 4;
125 repsize[bufcount++] = xattr_acl_size(LL_ACL_MAX_ENTRIES);
128 req->rq_replen = lustre_msg_size(bufcount, repsize);
130 mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
131 rc = ptlrpc_queue_wait(req);
132 mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
136 body = lustre_swab_repbuf (req, 0, sizeof (*body),
137 lustre_swab_mds_body);
139 CERROR ("Can't unpack mds_body\n");
143 CDEBUG(D_NET, "mode: %o\n", body->mode);
145 LASSERT_REPSWAB (req, 1);
147 /* Skip the check if getxattr/listxattr are called with no buffers */
148 if ((reqbody->valid & (OBD_MD_FLEA | OBD_MD_FLEALIST)) &&
149 (reqbody->eadatasize != 0)){
150 if (body->eadatasize != 0) {
151 /* reply indicates presence of eadata; check it's there... */
152 eadata = lustre_msg_buf (req->rq_repmsg, 1,
154 if (eadata == NULL) {
155 CERROR ("Missing/short eadata\n");
164 int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
165 __u64 valid, const char *ea_name, int ea_namelen,
166 unsigned int ea_size, struct ptlrpc_request **request)
168 struct ptlrpc_request *req;
169 struct mds_body *body;
171 int size[3] = {0, sizeof(*body)};
175 /* XXX do we need to make another request here? We just did a getattr
176 * to do the lookup in the first place.
178 size[0] = lustre_secdesc_size();
180 LASSERT((ea_name != NULL) == (ea_namelen != 0));
181 if (valid & (OBD_MD_FLEA | OBD_MD_FLEALIST)) {
182 size[bufcount] = ea_namelen;
186 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
187 MDS_GETATTR, bufcount, size, NULL);
189 GOTO(out, rc = -ENOMEM);
191 lustre_pack_secdesc(req, size[0]);
193 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
194 memcpy(&body->id1, id, sizeof(*id));
196 body->eadatasize = ea_size;
199 if (valid & OBD_MD_FLEA) {
200 LASSERT(strnlen(ea_name, ea_namelen) == (ea_namelen - 1));
201 memcpy(lustre_msg_buf(req->rq_reqmsg, 2, ea_namelen),
202 ea_name, ea_namelen);
205 rc = mdc_getattr_common(exp, ea_size, req);
207 ptlrpc_req_finished (req);
215 int mdc_getattr_lock(struct obd_export *exp, struct lustre_id *id,
216 char *filename, int namelen, __u64 valid,
217 unsigned int ea_size, struct ptlrpc_request **request)
219 struct ptlrpc_request *req;
220 struct mds_body *body;
221 int rc, size[3] = {0, sizeof(*body), namelen};
224 size[0] = lustre_secdesc_size();
226 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
227 MDS_GETATTR_LOCK, 3, size, NULL);
229 GOTO(out, rc = -ENOMEM);
231 lustre_pack_secdesc(req, size[0]);
233 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
234 memcpy(&body->id1, id, sizeof(*id));
236 body->eadatasize = ea_size;
238 if (filename != NULL) {
239 LASSERT (strnlen (filename, namelen) == namelen - 1);
240 memcpy(lustre_msg_buf(req->rq_reqmsg, 2, namelen),
243 LASSERT(namelen == 1);
246 rc = mdc_getattr_common(exp, ea_size, req);
248 ptlrpc_req_finished (req);
256 /* This should be called with both the request and the reply still packed. */
257 int mdc_store_inode_generation(struct obd_export *exp,
258 struct ptlrpc_request *req,
259 int reqoff, int repoff)
261 struct mds_rec_create *rec =
262 lustre_msg_buf(req->rq_reqmsg, reqoff, sizeof(*rec));
263 struct mds_body *body =
264 lustre_msg_buf(req->rq_repmsg, repoff, sizeof(*body));
266 LASSERT (rec != NULL);
267 LASSERT (body != NULL);
269 memcpy(&rec->cr_replayid, &body->id1, sizeof(rec->cr_replayid));
270 DEBUG_REQ(D_HA, req, "storing generation for ino "DLID4,
271 OLID4(&rec->cr_replayid));
275 int mdc_req2lustre_md(struct obd_export *exp_lmv, struct ptlrpc_request *req,
276 unsigned int offset, struct obd_export *exp_lov,
277 struct lustre_md *md)
282 struct posix_acl *acl;
283 struct lov_mds_md *lmm;
287 memset(md, 0, sizeof(*md));
289 md->body = lustre_msg_buf(req->rq_repmsg, offset,
294 LASSERT_REPSWABBED(req, offset);
296 if (!(md->body->valid & OBD_MD_FLEASIZE) &&
297 !(md->body->valid & OBD_MD_FLDIREA))
300 if (S_ISREG(md->body->mode)) {
301 if (md->body->eadatasize == 0) {
302 CERROR("invalid EA size (0) is detected\n");
306 lmm = lustre_msg_buf(req->rq_repmsg, offset + 1,
307 md->body->eadatasize);
311 LASSERT(exp_lov != NULL);
313 rc = obd_unpackmd(exp_lov, &md->lsm, lmm,
314 md->body->eadatasize);
316 LASSERT(rc >= sizeof(*md->lsm));
319 } else if (S_ISDIR(md->body->mode)) {
320 /* dir can be non-splitted */
321 if (md->body->eadatasize == 0)
324 lmm = lustre_msg_buf(req->rq_repmsg, offset + 1,
325 md->body->eadatasize);
329 if (md->body->valid & OBD_MD_MEA) {
330 LASSERT(exp_lmv != NULL);
332 rc = obd_unpackmd(exp_lmv, (void *)&md->mea,
333 lmm, md->body->eadatasize);
335 LASSERT(rc >= sizeof(*md->mea));
340 LASSERT(S_ISCHR(md->body->mode) ||
341 S_ISBLK(md->body->mode) ||
342 S_ISFIFO(md->body->mode)||
343 S_ISLNK(md->body->mode) ||
344 S_ISSOCK(md->body->mode));
347 acl_off = (md->body->valid & OBD_MD_FLEASIZE) ? (offset + 2) :
350 if (md->body->valid & OBD_MD_FLACL_ACCESS) {
351 size = le32_to_cpu(*(__u32 *) lustre_msg_buf(req->rq_repmsg,
353 buf = lustre_msg_buf(req->rq_repmsg, acl_off + 1, size);
355 acl = posix_acl_from_xattr(buf, size);
358 CERROR("convert xattr to acl failed: %d\n", rc);
361 rc = posix_acl_valid(acl);
363 CERROR("acl valid error: %d\n", rc);
364 posix_acl_release(acl);
369 md->acl_access = acl;
374 static void mdc_commit_open(struct ptlrpc_request *req)
376 struct mdc_open_data *mod = req->rq_cb_data;
380 if (mod->mod_close_req != NULL)
381 mod->mod_close_req->rq_cb_data = NULL;
383 if (mod->mod_och != NULL)
384 mod->mod_och->och_mod = NULL;
386 OBD_FREE(mod, sizeof(*mod));
387 req->rq_cb_data = NULL;
390 static void mdc_replay_open(struct ptlrpc_request *req)
392 struct mdc_open_data *mod = req->rq_cb_data;
393 struct obd_client_handle *och;
394 struct ptlrpc_request *close_req;
395 struct lustre_handle old;
396 struct mds_body *body;
399 body = lustre_swab_repbuf(req, 1, sizeof(*body), lustre_swab_mds_body);
400 LASSERT (body != NULL);
403 DEBUG_REQ(D_ERROR, req,
404 "can't properly replay without open data");
411 struct lustre_handle *file_fh;
412 LASSERT(och->och_magic == OBD_CLIENT_HANDLE_MAGIC);
413 file_fh = &och->och_fh;
414 CDEBUG(D_HA, "updating handle from "LPX64" to "LPX64"\n",
415 file_fh->cookie, body->handle.cookie);
416 memcpy(&old, file_fh, sizeof(old));
417 memcpy(file_fh, &body->handle, sizeof(*file_fh));
420 close_req = mod->mod_close_req;
421 if (close_req != NULL) {
422 struct mds_body *close_body;
423 LASSERT(close_req->rq_reqmsg->opc == MDS_CLOSE);
424 close_body = lustre_msg_buf(close_req->rq_reqmsg,
426 sizeof(*close_body));
428 LASSERT(!memcmp(&old, &close_body->handle, sizeof old));
429 DEBUG_REQ(D_HA, close_req, "updating close body with new fh");
430 memcpy(&close_body->handle, &body->handle,
431 sizeof(close_body->handle));
437 int mdc_set_open_replay_data(struct obd_export *exp,
438 struct obd_client_handle *och,
439 struct ptlrpc_request *open_req)
441 struct mdc_open_data *mod;
442 struct mds_rec_create *rec;
443 struct mds_body *body;
445 rec = lustre_msg_buf(open_req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF,
447 body = lustre_msg_buf(open_req->rq_repmsg, 1, sizeof(*body));
449 LASSERT(rec != NULL);
450 /* outgoing messages always in my byte order */
451 LASSERT(body != NULL);
452 /* incoming message in my byte order (it's been swabbed) */
453 LASSERT_REPSWABBED(open_req, 1);
455 OBD_ALLOC(mod, sizeof(*mod));
457 DEBUG_REQ(D_ERROR, open_req, "can't allocate mdc_open_data");
463 mod->mod_open_req = open_req;
465 memcpy(&rec->cr_replayid, &body->id1, sizeof rec->cr_replayid);
466 open_req->rq_replay_cb = mdc_replay_open;
467 open_req->rq_commit_cb = mdc_commit_open;
468 open_req->rq_cb_data = mod;
469 DEBUG_REQ(D_HA, open_req, "set up replay data");
473 int mdc_clear_open_replay_data(struct obd_export *exp,
474 struct obd_client_handle *och)
476 struct mdc_open_data *mod = och->och_mod;
478 /* Don't free the structure now (it happens in mdc_commit_open, after
479 * we're sure we won't need to fix up the close request in the future),
480 * but make sure that replay doesn't poke at the och, which is about to
482 LASSERT(mod != LP_POISON);
489 static void mdc_commit_close(struct ptlrpc_request *req)
491 struct mdc_open_data *mod = req->rq_cb_data;
492 struct ptlrpc_request *open_req;
493 struct obd_import *imp = req->rq_import;
495 DEBUG_REQ(D_HA, req, "close req committed");
499 mod->mod_close_req = NULL;
500 req->rq_cb_data = NULL;
501 req->rq_commit_cb = NULL;
503 open_req = mod->mod_open_req;
504 LASSERT(open_req != NULL);
505 LASSERT(open_req != LP_POISON);
506 LASSERT(open_req->rq_type != LI_POISON);
508 DEBUG_REQ(D_HA, open_req, "open req balanced");
509 if (open_req->rq_transno == 0) {
510 DEBUG_REQ(D_ERROR, open_req, "BUG 3892 open");
511 DEBUG_REQ(D_ERROR, req, "BUG 3892 close");
512 LASSERTF(open_req->rq_transno != 0, "BUG 3892");
514 LASSERT(open_req->rq_import == imp);
516 /* We no longer want to preserve this for transno-unconditional
518 spin_lock(&open_req->rq_lock);
519 open_req->rq_replay = 0;
520 spin_unlock(&open_req->rq_lock);
523 static int mdc_close_interpret(struct ptlrpc_request *req,
526 union ptlrpc_async_args *aa = data;
527 struct mdc_rpc_lock *close_lock;
528 struct obd_device *obd = aa->pointer_arg[1];
531 spin_lock_irqsave(&req->rq_lock, flags);
532 close_lock = aa->pointer_arg[0];
533 aa->pointer_arg[0] = NULL;
534 spin_unlock_irqrestore (&req->rq_lock, flags);
536 if (close_lock == NULL) {
537 CERROR("called with NULL close_lock\n");
539 mdc_put_rpc_lock(close_lock, NULL);
540 LASSERTF(close_lock == obd->u.cli.cl_close_lock, "%p != %p\n",
541 close_lock, obd->u.cli.cl_close_lock);
543 wake_up(&req->rq_reply_waitq);
547 /* We can't use ptlrpc_check_reply, because we don't want to wake up for
548 * anything but a reply or an error. */
549 static int mdc_close_check_reply(struct ptlrpc_request *req)
554 spin_lock_irqsave(&req->rq_lock, flags);
555 if (req->rq_async_args.pointer_arg[0] == NULL)
557 spin_unlock_irqrestore (&req->rq_lock, flags);
561 int mdc_close(struct obd_export *exp, struct obdo *oa,
562 struct obd_client_handle *och,
563 struct ptlrpc_request **request)
565 struct obd_device *obd = class_exp2obd(exp);
566 struct obd_import *imp = class_exp2cliimp(exp);
567 int reqsize[3] = {0, sizeof(struct mds_body),
568 obd->u.cli.cl_max_mds_cookiesize};
569 int rc, repsize[3] = {sizeof(struct mds_body),
570 obd->u.cli.cl_max_mds_easize,
571 obd->u.cli.cl_max_mds_cookiesize};
572 struct ptlrpc_request *req;
573 struct mdc_open_data *mod;
574 struct l_wait_info lwi;
577 if (imp->imp_connection == NULL) {
578 CERROR("request on not connected import %s\n",
579 imp->imp_obd->obd_name);
583 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
584 MDS_CLOSE, 3, reqsize, NULL);
586 GOTO(out, rc = -ENOMEM);
588 //reqsize[0] = lustre_secdesc_size();
589 //lustre_pack_secdesc(req, reqsize[0]);
591 /* Ensure that this close's handle is fixed up during replay. */
592 LASSERT(och != NULL);
594 if (likely(mod != NULL)) {
595 mod->mod_close_req = req;
596 LASSERT(mod->mod_open_req->rq_type != LI_POISON);
597 DEBUG_REQ(D_HA, mod->mod_open_req, "matched open");
599 CDEBUG(D_HA, "couldn't find open req; "
600 "expecting close error\n");
603 mdc_close_pack(req, 1, oa, oa->o_valid, och);
605 req->rq_replen = lustre_msg_size(3, repsize);
606 req->rq_commit_cb = mdc_commit_close;
607 LASSERT(req->rq_cb_data == NULL);
608 req->rq_cb_data = mod;
610 /* We hand a ref to the rpcd here, so we need another one of our own. */
611 ptlrpc_request_addref(req);
613 mdc_get_rpc_lock(obd->u.cli.cl_close_lock, NULL);
614 req->rq_interpret_reply = mdc_close_interpret;
615 req->rq_async_args.pointer_arg[0] = obd->u.cli.cl_close_lock;
616 req->rq_async_args.pointer_arg[1] = obd;
617 ptlrpcd_add_req(req);
619 lwi = LWI_TIMEOUT_INTR(MAX(req->rq_timeout * HZ, 1), NULL, NULL, NULL);
620 rc = l_wait_event(req->rq_reply_waitq, mdc_close_check_reply(req),
622 if (req->rq_repmsg == NULL) {
623 CDEBUG(D_HA, "request failed to send: %p, %d\n", req,
626 rc = req->rq_status ? req->rq_status : -EIO;
627 } else if (rc == 0) {
628 rc = req->rq_repmsg->status;
629 if (req->rq_repmsg->type == PTL_RPC_MSG_ERR) {
630 DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, "
636 CERROR("Unexpected: can't find mdc_open_data, but "
637 "close succeeded. Please tell CFS.\n");
638 if (!lustre_swab_repbuf(req, 0, sizeof(struct mds_body),
639 lustre_swab_mds_body))
641 CERROR("Error unpacking mds_body\n");
646 if (req->rq_async_args.pointer_arg[0] != NULL) {
647 CERROR("returned without dropping close lock: rc %d, "
648 "dropping it now\n", rc);
649 mdc_close_interpret(req, &req->rq_async_args, rc);
658 int mdc_done_writing(struct obd_export *exp, struct obdo *obdo)
660 struct ptlrpc_request *req;
661 struct mds_body *body;
662 int rc, size[2] = {0, sizeof(*body)};
665 size[0] = lustre_secdesc_size();
667 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
668 MDS_DONE_WRITING, 2, size, NULL);
672 lustre_pack_secdesc(req, size[0]);
674 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
677 mdc_pack_id(&body->id1, obdo->o_id, 0, obdo->o_mode,
678 obdo->o_mds, obdo->o_fid);
680 body->size = obdo->o_size;
681 body->blocks = obdo->o_blocks;
682 body->flags = obdo->o_flags;
683 body->valid = obdo->o_valid;
685 req->rq_replen = lustre_msg_size(1, &size[1]);
687 rc = ptlrpc_queue_wait(req);
688 ptlrpc_req_finished(req);
692 int mdc_readpage(struct obd_export *exp,
693 struct lustre_id *id,
694 __u64 offset, struct page *page,
695 struct ptlrpc_request **request)
697 struct obd_import *imp = class_exp2cliimp(exp);
698 struct ptlrpc_request *req = NULL;
699 struct ptlrpc_bulk_desc *desc = NULL;
700 struct mds_body *body;
701 int rc, size[2] = {0, sizeof(*body)};
704 CDEBUG(D_INODE, "inode: %ld\n", (long)id->li_stc.u.e3s.l3s_ino);
706 size[0] = lustre_secdesc_size();
708 req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_READPAGE,
711 GOTO(out, rc = -ENOMEM);
712 /* XXX FIXME bug 249 */
713 req->rq_request_portal = MDS_READPAGE_PORTAL;
715 lustre_pack_secdesc(req, size[0]);
717 desc = ptlrpc_prep_bulk_imp(req, 1, BULK_PUT_SINK, MDS_BULK_PORTAL);
719 GOTO(out, rc = -ENOMEM);
720 /* NB req now owns desc and will free it when it gets freed */
722 ptlrpc_prep_bulk_page(desc, page, 0, PAGE_CACHE_SIZE);
723 mdc_readdir_pack(req, 1, offset, PAGE_CACHE_SIZE, id);
725 req->rq_replen = lustre_msg_size(1, &size[1]);
726 rc = ptlrpc_queue_wait(req);
729 body = lustre_swab_repbuf(req, 0, sizeof (*body),
730 lustre_swab_mds_body);
732 CERROR("Can't unpack mds_body\n");
733 GOTO(out, rc = -EPROTO);
736 if (req->rq_bulk->bd_nob_transferred != PAGE_CACHE_SIZE) {
737 CERROR ("Unexpected # bytes transferred: %d"
739 req->rq_bulk->bd_nob_transferred,
741 GOTO (out, rc = -EPROTO);
751 static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
752 void *karg, void *uarg)
754 struct obd_device *obd = exp->exp_obd;
755 struct obd_ioctl_data *data = karg;
756 struct obd_import *imp = obd->u.cli.cl_import;
757 struct llog_ctxt *ctxt;
761 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
764 if (!try_module_get(THIS_MODULE)) {
765 CERROR("Can't get module. Is it alive?");
770 case OBD_IOC_CLIENT_RECOVER:
771 rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1);
775 case IOC_OSC_SET_ACTIVE:
776 rc = ptlrpc_set_import_active(imp, data->ioc_offset);
778 case IOC_OSC_CTL_RECOVERY:
779 rc = ptlrpc_import_control_recovery(imp, data->ioc_offset);
781 case OBD_IOC_PARSE: {
782 ctxt = llog_get_context(&exp->exp_obd->obd_llogs,
783 LLOG_CONFIG_REPL_CTXT);
784 rc = class_config_process_llog(ctxt, data->ioc_inlbuf1, NULL);
788 case OBD_IOC_LLOG_INFO:
789 case OBD_IOC_LLOG_PRINT: {
790 ctxt = llog_get_context(&obd->obd_llogs, LLOG_CONFIG_REPL_CTXT);
791 rc = llog_ioctl(ctxt, cmd, data);
797 CERROR("mdc_ioctl(): unrecognised ioctl %#x\n", cmd);
798 GOTO(out, rc = -ENOTTY);
801 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
804 module_put(THIS_MODULE);
810 int mdc_set_info(struct obd_export *exp, obd_count keylen,
811 void *key, obd_count vallen, void *val)
815 if (keylen == strlen("initial_recov") &&
816 memcmp(key, "initial_recov", strlen("initial_recov")) == 0) {
817 struct obd_import *imp = exp->exp_obd->u.cli.cl_import;
818 if (vallen != sizeof(int))
820 imp->imp_initial_recov = *(int *)val;
821 CDEBUG(D_HA, "%s: set imp_no_init_recov = %d\n",
822 exp->exp_obd->obd_name,
823 imp->imp_initial_recov);
825 } else if (keylen >= strlen("mds_type") && strcmp(key, "mds_type") == 0) {
826 struct ptlrpc_request *req;
827 char *bufs[2] = {key, val};
828 int rc, size[2] = {keylen, vallen};
830 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
831 OST_SET_INFO, 2, size, bufs);
835 req->rq_replen = lustre_msg_size(0, NULL);
836 rc = ptlrpc_queue_wait(req);
837 ptlrpc_req_finished(req);
839 } else if (keylen >= strlen("inter_mds") && strcmp(key, "inter_mds") == 0) {
840 struct obd_import *imp = class_exp2cliimp(exp);
841 imp->imp_server_timeout = 1;
842 CDEBUG(D_OTHER, "%s: timeout / 2\n", exp->exp_obd->obd_name);
844 } else if (keylen == strlen("sec") && memcmp(key, "sec", keylen) == 0) {
845 struct client_obd *cli = &exp->exp_obd->u.cli;
847 if (vallen == strlen("null") &&
848 memcmp(val, "null", vallen) == 0) {
849 cli->cl_sec_flavor = PTLRPC_SEC_NULL;
850 cli->cl_sec_subflavor = 0;
853 if (vallen == strlen("krb5i") &&
854 memcmp(val, "krb5i", vallen) == 0) {
855 cli->cl_sec_flavor = PTLRPC_SEC_GSS;
856 cli->cl_sec_subflavor = PTLRPC_SEC_GSS_KRB5I;
859 if (vallen == strlen("krb5p") &&
860 memcmp(val, "krb5p", vallen) == 0) {
861 cli->cl_sec_flavor = PTLRPC_SEC_GSS;
862 cli->cl_sec_subflavor = PTLRPC_SEC_GSS_KRB5P;
865 CERROR("unrecognized security type %s\n", (char*) val);
867 } else if (keylen == strlen("async") && memcmp(key, "async", keylen) == 0) {
868 struct client_obd *cl = &exp->exp_obd->u.cli;
869 if (vallen != sizeof(int))
871 cl->cl_async = *(int *)val;
872 CDEBUG(D_HA, "%s: set async = %d\n",
873 exp->exp_obd->obd_name, cl->cl_async);
879 static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
880 unsigned long max_age)
882 struct obd_statfs *msfs;
883 struct ptlrpc_request *req;
884 int rc, size = sizeof(*msfs);
887 /* We could possibly pass max_age in the request (as an absolute
888 * timestamp or a "seconds.usec ago") so the target can avoid doing
889 * extra calls into the filesystem if that isn't necessary (e.g.
890 * during mount that would help a bit). Having relative timestamps
891 * is not so great if request processing is slow, while absolute
892 * timestamps are not ideal because they need time synchronization. */
893 req = ptlrpc_prep_req(obd->u.cli.cl_import, LUSTRE_MDS_VERSION,
894 MDS_STATFS, 0, NULL, NULL);
898 req->rq_replen = lustre_msg_size(1, &size);
900 mdc_get_rpc_lock(obd->u.cli.cl_rpc_lock, NULL);
901 rc = ptlrpc_queue_wait(req);
902 mdc_put_rpc_lock(obd->u.cli.cl_rpc_lock, NULL);
905 /* this can be LMV fake import, whcih is not connected. */
906 if (!req->rq_import->imp_connection)
907 memset(osfs, 0, sizeof(*osfs));
911 msfs = lustre_swab_repbuf(req, 0, sizeof(*msfs),
912 lustre_swab_obd_statfs);
914 CERROR("Can't unpack obd_statfs\n");
915 GOTO(out, rc = -EPROTO);
918 memcpy(osfs, msfs, sizeof (*msfs));
921 ptlrpc_req_finished(req);
925 static int mdc_pin(struct obd_export *exp, obd_id ino, __u32 gen, int type,
926 struct obd_client_handle *handle, int flag)
928 struct ptlrpc_request *req;
929 struct mds_body *body;
930 int rc, size[2] = {0, sizeof(*body)};
933 //size[0] = lustre_secdesc_size();
935 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
936 MDS_PIN, 2, size, NULL);
940 //lustre_pack_secdesc(req, size[0]);
942 body = lustre_msg_buf(req->rq_reqmsg,
943 MDS_REQ_REC_OFF, sizeof(*body));
945 /* FIXME-UMKA: here should be also mdsnum and fid. */
946 mdc_pack_id(&body->id1, ino, gen, type, 0, 0);
949 req->rq_replen = lustre_msg_size(1, &size[1]);
951 mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
952 rc = ptlrpc_queue_wait(req);
953 mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
955 CERROR("pin failed: %d\n", rc);
956 ptlrpc_req_finished(req);
960 body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
962 ptlrpc_req_finished(req);
966 memcpy(&handle->och_fh, &body->handle, sizeof(body->handle));
967 handle->och_magic = OBD_CLIENT_HANDLE_MAGIC;
969 OBD_ALLOC(handle->och_mod, sizeof(*handle->och_mod));
970 if (handle->och_mod == NULL) {
971 DEBUG_REQ(D_ERROR, req, "can't allocate mdc_open_data");
974 handle->och_mod->mod_open_req = req; /* will be dropped by unpin */
979 static int mdc_unpin(struct obd_export *exp,
980 struct obd_client_handle *handle, int flag)
982 struct ptlrpc_request *req;
983 struct mds_body *body;
984 int rc, size[2] = {0, sizeof(*body)};
987 if (handle->och_magic != OBD_CLIENT_HANDLE_MAGIC)
990 //size[0] = lustre_secdesc_size();
992 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
993 MDS_CLOSE, 2, size, NULL);
997 //lustre_pack_secdesc(req, size[0]);
999 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
1000 memcpy(&body->handle, &handle->och_fh, sizeof(body->handle));
1003 req->rq_replen = lustre_msg_size(0, NULL);
1004 mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
1005 rc = ptlrpc_queue_wait(req);
1006 mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
1009 CERROR("unpin failed: %d\n", rc);
1011 ptlrpc_req_finished(req);
1012 ptlrpc_req_finished(handle->och_mod->mod_open_req);
1013 OBD_FREE(handle->och_mod, sizeof(*handle->och_mod));
1017 int mdc_sync(struct obd_export *exp, struct lustre_id *id,
1018 struct ptlrpc_request **request)
1020 struct ptlrpc_request *req;
1021 struct mds_body *body;
1022 int size[2] = {0, sizeof(*body)};
1026 //size[0] = lustre_secdesc_size();
1028 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
1029 MDS_SYNC, 2, size, NULL);
1031 RETURN(rc = -ENOMEM);
1033 //lustre_pack_secdesc(req, size[0]);
1036 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
1038 memcpy(&body->id1, id, sizeof(*id));
1041 req->rq_replen = lustre_msg_size(1, &size[1]);
1043 rc = ptlrpc_queue_wait(req);
1044 if (rc || request == NULL)
1045 ptlrpc_req_finished(req);
1052 static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
1053 enum obd_import_event event)
1057 LASSERT(imp->imp_obd == obd);
1060 case IMP_EVENT_DISCON: {
1063 case IMP_EVENT_INACTIVE: {
1064 if (obd->obd_observer)
1065 rc = obd_notify(obd->obd_observer, obd, 0, 0);
1068 case IMP_EVENT_INVALIDATE: {
1069 struct ldlm_namespace *ns = obd->obd_namespace;
1071 ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
1075 case IMP_EVENT_ACTIVE: {
1076 if (obd->obd_observer)
1077 rc = obd_notify(obd->obd_observer, obd, 1, 0);
1081 CERROR("Unknown import event %d\n", event);
1087 static int mdc_attach(struct obd_device *dev, obd_count len, void *data)
1089 struct lprocfs_static_vars lvars;
1091 lprocfs_init_vars(mdc, &lvars);
1092 return lprocfs_obd_attach(dev, lvars.obd_vars);
1095 static int mdc_detach(struct obd_device *dev)
1097 return lprocfs_obd_detach(dev);
1100 static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
1102 struct client_obd *cli = &obd->u.cli;
1106 OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1107 if (!cli->cl_rpc_lock)
1109 mdc_init_rpc_lock(cli->cl_rpc_lock);
1113 OBD_ALLOC(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1114 if (!cli->cl_setattr_lock)
1115 GOTO(err_rpc_lock, rc = -ENOMEM);
1116 mdc_init_rpc_lock(cli->cl_setattr_lock);
1118 OBD_ALLOC(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1119 if (!cli->cl_close_lock)
1120 GOTO(err_setattr_lock, rc = -ENOMEM);
1121 mdc_init_rpc_lock(cli->cl_close_lock);
1123 rc = client_obd_setup(obd, len, buf);
1125 GOTO(err_close_lock, rc);
1127 rc = obd_llog_init(obd, &obd->obd_llogs, obd, 0, NULL);
1129 mdc_cleanup(obd, 0);
1130 CERROR("failed to setup llogging subsystems\n");
1136 OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1138 OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1140 OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1145 static int mdc_init_ea_size(struct obd_export *exp, int easize, int cookiesize)
1147 struct obd_device *obd = exp->exp_obd;
1148 struct client_obd *cli = &obd->u.cli;
1151 if (cli->cl_max_mds_easize < easize)
1152 cli->cl_max_mds_easize = easize;
1153 if (cli->cl_max_mds_cookiesize < cookiesize)
1154 cli->cl_max_mds_cookiesize = cookiesize;
1158 static int mdc_precleanup(struct obd_device *obd, int flags)
1162 rc = obd_llog_finish(obd, &obd->obd_llogs, 0);
1164 CERROR("failed to cleanup llogging subsystems\n");
1169 static int mdc_cleanup(struct obd_device *obd, int flags)
1171 struct client_obd *cli = &obd->u.cli;
1173 OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1174 OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1175 OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1179 return client_obd_cleanup(obd, flags);
1183 static int mdc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
1184 struct obd_device *tgt, int count,
1185 struct llog_catid *logid)
1187 struct llog_ctxt *ctxt;
1191 rc = obd_llog_setup(obd, llogs, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL,
1194 ctxt = llog_get_context(llogs, LLOG_CONFIG_REPL_CTXT);
1195 ctxt->loc_imp = obd->u.cli.cl_import;
1201 static int mdc_llog_finish(struct obd_device *obd,
1202 struct obd_llogs *llogs, int count)
1207 rc = obd_llog_cleanup(llog_get_context(llogs, LLOG_CONFIG_REPL_CTXT));
1210 static struct obd_device *mdc_get_real_obd(struct obd_export *exp,
1211 struct lustre_id *id)
1214 RETURN(exp->exp_obd);
1217 static int mdc_get_info(struct obd_export *exp, __u32 keylen,
1218 void *key, __u32 *valsize, void *val)
1220 struct ptlrpc_request *req;
1221 char *bufs[1] = {key};
1225 if (!valsize || !val)
1228 if (keylen == strlen("remote_flag") && !strcmp(key, "remote_flag")) {
1229 struct obd_import *imp;
1230 struct obd_connect_data *data;
1232 imp = class_exp2cliimp(exp);
1238 if (imp->imp_state != LUSTRE_IMP_FULL) {
1239 CERROR("import state not full\n");
1243 data = &imp->imp_connect_data;
1244 if (data->ocd_connect_flags & OBD_CONNECT_REMOTE) {
1247 } else if (data->ocd_connect_flags & OBD_CONNECT_LOCAL) {
1251 CERROR("no remote flag set?\n");
1255 if ((keylen < strlen("mdsize") || strcmp(key, "mdsize") != 0) &&
1256 (keylen < strlen("mdsnum") || strcmp(key, "mdsnum") != 0) &&
1257 (keylen < strlen("rootid") || strcmp(key, "rootid") != 0))
1260 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
1261 OST_GET_INFO, 1, (int *)&keylen, bufs);
1265 req->rq_replen = lustre_msg_size(1, (int *)valsize);
1266 rc = ptlrpc_queue_wait(req);
1270 if (keylen >= strlen("rootid") && !strcmp(key, "rootid")) {
1271 struct lustre_id *reply;
1273 reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
1274 lustre_swab_lustre_id);
1275 if (reply == NULL) {
1276 CERROR("Can't unpack %s\n", (char *)key);
1277 GOTO(out_req, rc = -EPROTO);
1280 *(struct lustre_id *)val = *reply;
1284 reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
1285 lustre_swab_generic_32s);
1286 if (reply == NULL) {
1287 CERROR("Can't unpack %s\n", (char *)key);
1288 GOTO(out_req, rc = -EPROTO);
1290 *((__u32 *)val) = *reply;
1293 ptlrpc_req_finished(req);
1297 int mdc_obj_create(struct obd_export *exp, struct obdo *oa,
1298 void *acl, int acl_size,
1299 struct lov_stripe_md **ea, struct obd_trans_info *oti)
1301 struct ptlrpc_request *request;
1302 struct ost_body *body;
1304 int rc, size[2] = { sizeof(*body), acl_size };
1309 request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
1310 OST_CREATE, 2, size, NULL);
1312 GOTO(out_req, rc = -ENOMEM);
1314 body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof (*body));
1315 memcpy(&body->oa, oa, sizeof(body->oa));
1318 acl_buf = lustre_msg_buf(request->rq_reqmsg, 1, acl_size);
1319 memcpy(acl_buf, acl, acl_size);
1322 request->rq_replen = lustre_msg_size(1, size);
1323 rc = ptlrpc_queue_wait(request);
1327 body = lustre_swab_repbuf(request, 0, sizeof(*body),
1328 lustre_swab_ost_body);
1330 CERROR ("can't unpack ost_body\n");
1331 GOTO (out_req, rc = -EPROTO);
1334 memcpy(oa, &body->oa, sizeof(*oa));
1336 /* store ino/generation for recovery */
1337 body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof (*body));
1338 body->oa.o_id = oa->o_id;
1339 body->oa.o_generation = oa->o_generation;
1340 body->oa.o_fid = oa->o_fid;
1341 body->oa.o_mds = oa->o_mds;
1343 CDEBUG(D_HA, "transno: "LPD64"\n", request->rq_repmsg->transno);
1346 ptlrpc_req_finished(request);
1350 int mdc_brw(int rw, struct obd_export *exp, struct obdo *oa,
1351 struct lov_stripe_md *ea, obd_count oa_bufs,
1352 struct brw_page *pgarr, struct obd_trans_info *oti)
1354 struct ptlrpc_bulk_desc *desc;
1355 struct niobuf_remote *niobuf;
1356 struct ptlrpc_request *req;
1357 struct obd_ioobj *ioobj;
1358 struct ost_body *body;
1362 opc = ((rw & OBD_BRW_WRITE) != 0) ? OST_WRITE : OST_READ;
1364 size[0] = sizeof(*body);
1365 size[1] = sizeof(*ioobj);
1366 size[2] = oa_bufs * sizeof(*niobuf);
1368 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION, opc,
1370 LASSERT(req != NULL);
1372 if (opc == OST_WRITE)
1373 desc = ptlrpc_prep_bulk_imp(req, oa_bufs, BULK_GET_SOURCE,
1376 desc = ptlrpc_prep_bulk_imp(req, oa_bufs, BULK_PUT_SINK,
1378 LASSERT(desc != NULL);
1380 body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
1381 ioobj = lustre_msg_buf(req->rq_reqmsg, 1, sizeof(*ioobj));
1382 niobuf = lustre_msg_buf(req->rq_reqmsg, 2, oa_bufs * sizeof(*niobuf));
1384 memcpy(&body->oa, oa, sizeof(*oa));
1385 obdo_to_ioobj(oa, ioobj);
1386 ioobj->ioo_bufcnt = oa_bufs;
1388 for (i = 0; i < oa_bufs; i++, niobuf++) {
1389 struct brw_page *pg = &pgarr[i];
1391 LASSERT(pg->count > 0);
1392 LASSERT((pg->disk_offset & ~PAGE_MASK) + pg->count <= PAGE_SIZE);
1394 ptlrpc_prep_bulk_page(desc, pg->pg, pg->disk_offset & ~PAGE_MASK,
1397 niobuf->offset = pg->disk_offset;
1398 niobuf->len = pg->count;
1399 niobuf->flags = pg->flag;
1402 /* size[0] still sizeof (*body) */
1403 if (opc == OST_WRITE) {
1404 /* 1 RC per niobuf */
1405 size[1] = sizeof(__u32) * oa_bufs;
1406 req->rq_replen = lustre_msg_size(2, size);
1408 /* 1 RC for the whole I/O */
1409 req->rq_replen = lustre_msg_size(1, size);
1411 err = ptlrpc_queue_wait(req);
1414 ptlrpc_req_finished(req);
1418 static int mdc_valid_attrs(struct obd_export *exp,
1419 struct lustre_id *id)
1421 struct ldlm_res_id res_id = { .name = {0} };
1422 struct obd_device *obd = exp->exp_obd;
1423 struct lustre_handle lockh;
1424 ldlm_policy_data_t policy;
1428 res_id.name[0] = id_fid(id);
1429 res_id.name[1] = id_group(id);
1430 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
1432 CDEBUG(D_INFO, "trying to match res "LPU64"\n",
1435 /* FIXME use LDLM_FL_TEST_LOCK instead */
1436 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING;
1437 if (ldlm_lock_match(obd->obd_namespace, flags, &res_id,
1438 LDLM_IBITS, &policy, LCK_PR, &lockh)) {
1439 ldlm_lock_decref(&lockh, LCK_PR);
1443 if (ldlm_lock_match(obd->obd_namespace, flags, &res_id,
1444 LDLM_IBITS, &policy, LCK_PW, &lockh)) {
1445 ldlm_lock_decref(&lockh, LCK_PW);
1451 static int mdc_change_cbdata_name(struct obd_export *exp,
1452 struct lustre_id *pid,
1453 char *name, int len,
1454 struct lustre_id *cid,
1455 ldlm_iterator_t it, void *data)
1458 rc = mdc_change_cbdata(exp, cid, it, data);
1462 struct obd_ops mdc_obd_ops = {
1463 .o_owner = THIS_MODULE,
1464 .o_attach = mdc_attach,
1465 .o_detach = mdc_detach,
1466 .o_setup = mdc_setup,
1467 .o_precleanup = mdc_precleanup,
1468 .o_cleanup = mdc_cleanup,
1469 .o_add_conn = client_import_add_conn,
1470 .o_del_conn = client_import_del_conn,
1471 .o_connect = client_connect_import,
1472 .o_disconnect = client_disconnect_export,
1473 .o_iocontrol = mdc_iocontrol,
1474 .o_packmd = mdc_packmd,
1475 .o_unpackmd = mdc_unpackmd,
1476 .o_statfs = mdc_statfs,
1478 .o_unpin = mdc_unpin,
1479 .o_import_event = mdc_import_event,
1480 .o_llog_init = mdc_llog_init,
1481 .o_llog_finish = mdc_llog_finish,
1482 .o_create = mdc_obj_create,
1483 .o_set_info = mdc_set_info,
1484 .o_get_info = mdc_get_info,
1486 .o_init_ea_size = mdc_init_ea_size,
1489 struct md_ops mdc_md_ops = {
1490 .m_getstatus = mdc_getstatus,
1491 .m_getattr = mdc_getattr,
1492 .m_close = mdc_close,
1493 .m_create = mdc_create,
1494 .m_done_writing = mdc_done_writing,
1495 .m_enqueue = mdc_enqueue,
1496 .m_getattr_lock = mdc_getattr_lock,
1497 .m_intent_lock = mdc_intent_lock,
1499 .m_rename = mdc_rename,
1500 .m_setattr = mdc_setattr,
1502 .m_readpage = mdc_readpage,
1503 .m_unlink = mdc_unlink,
1504 .m_valid_attrs = mdc_valid_attrs,
1505 .m_req2lustre_md = mdc_req2lustre_md,
1506 .m_set_open_replay_data = mdc_set_open_replay_data,
1507 .m_clear_open_replay_data = mdc_clear_open_replay_data,
1508 .m_store_inode_generation = mdc_store_inode_generation,
1509 .m_set_lock_data = mdc_set_lock_data,
1510 .m_get_real_obd = mdc_get_real_obd,
1511 .m_change_cbdata_name = mdc_change_cbdata_name,
1512 .m_change_cbdata = mdc_change_cbdata,
1515 int __init mdc_init(void)
1517 struct lprocfs_static_vars lvars;
1518 lprocfs_init_vars(mdc, &lvars);
1519 return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
1524 static void /*__exit*/ mdc_exit(void)
1526 class_unregister_type(LUSTRE_MDC_NAME);
1529 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
1530 MODULE_DESCRIPTION("Lustre Metadata Client");
1531 MODULE_LICENSE("GPL");
1533 EXPORT_SYMBOL(mdc_req2lustre_md);
1534 EXPORT_SYMBOL(mdc_change_cbdata);
1535 EXPORT_SYMBOL(mdc_getstatus);
1536 EXPORT_SYMBOL(mdc_getattr);
1537 EXPORT_SYMBOL(mdc_getattr_lock);
1538 EXPORT_SYMBOL(mdc_create);
1539 EXPORT_SYMBOL(mdc_unlink);
1540 EXPORT_SYMBOL(mdc_rename);
1541 EXPORT_SYMBOL(mdc_link);
1542 EXPORT_SYMBOL(mdc_readpage);
1543 EXPORT_SYMBOL(mdc_setattr);
1544 EXPORT_SYMBOL(mdc_close);
1545 EXPORT_SYMBOL(mdc_done_writing);
1546 EXPORT_SYMBOL(mdc_sync);
1547 EXPORT_SYMBOL(mdc_set_open_replay_data);
1548 EXPORT_SYMBOL(mdc_clear_open_replay_data);
1549 EXPORT_SYMBOL(mdc_store_inode_generation);
1551 module_init(mdc_init);
1552 module_exit(mdc_exit);