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 OBD_IOC_PARSE: {
779 ctxt = llog_get_context(&exp->exp_obd->obd_llogs,
780 LLOG_CONFIG_REPL_CTXT);
781 rc = class_config_process_llog(ctxt, data->ioc_inlbuf1, NULL);
785 case OBD_IOC_LLOG_INFO:
786 case OBD_IOC_LLOG_PRINT: {
787 ctxt = llog_get_context(&obd->obd_llogs, LLOG_CONFIG_REPL_CTXT);
788 rc = llog_ioctl(ctxt, cmd, data);
794 CERROR("mdc_ioctl(): unrecognised ioctl %#x\n", cmd);
795 GOTO(out, rc = -ENOTTY);
798 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
801 module_put(THIS_MODULE);
807 int mdc_set_info(struct obd_export *exp, obd_count keylen,
808 void *key, obd_count vallen, void *val)
812 if (keylen == strlen("initial_recov") &&
813 memcmp(key, "initial_recov", strlen("initial_recov")) == 0) {
814 struct obd_import *imp = exp->exp_obd->u.cli.cl_import;
815 if (vallen != sizeof(int))
817 imp->imp_initial_recov = *(int *)val;
818 CDEBUG(D_HA, "%s: set imp_no_init_recov = %d\n",
819 exp->exp_obd->obd_name,
820 imp->imp_initial_recov);
822 } else if (keylen >= strlen("mds_type") && strcmp(key, "mds_type") == 0) {
823 struct ptlrpc_request *req;
824 char *bufs[2] = {key, val};
825 int rc, size[2] = {keylen, vallen};
827 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
828 OST_SET_INFO, 2, size, bufs);
832 req->rq_replen = lustre_msg_size(0, NULL);
833 rc = ptlrpc_queue_wait(req);
834 ptlrpc_req_finished(req);
836 } else if (keylen >= strlen("inter_mds") && strcmp(key, "inter_mds") == 0) {
837 struct obd_import *imp = class_exp2cliimp(exp);
838 imp->imp_server_timeout = 1;
839 CDEBUG(D_OTHER, "%s: timeout / 2\n", exp->exp_obd->obd_name);
841 } else if (keylen == strlen("sec") && memcmp(key, "sec", keylen) == 0) {
842 struct client_obd *cli = &exp->exp_obd->u.cli;
844 if (vallen == strlen("null") &&
845 memcmp(val, "null", vallen) == 0) {
846 cli->cl_sec_flavor = PTLRPC_SEC_NULL;
847 cli->cl_sec_subflavor = 0;
850 if (vallen == strlen("krb5i") &&
851 memcmp(val, "krb5i", vallen) == 0) {
852 cli->cl_sec_flavor = PTLRPC_SEC_GSS;
853 cli->cl_sec_subflavor = PTLRPC_SEC_GSS_KRB5I;
856 if (vallen == strlen("krb5p") &&
857 memcmp(val, "krb5p", vallen) == 0) {
858 cli->cl_sec_flavor = PTLRPC_SEC_GSS;
859 cli->cl_sec_subflavor = PTLRPC_SEC_GSS_KRB5P;
862 CERROR("unrecognized security type %s\n", (char*) val);
864 } else if (keylen == strlen("async") && memcmp(key, "async", keylen) == 0) {
865 struct client_obd *cl = &exp->exp_obd->u.cli;
866 if (vallen != sizeof(int))
868 cl->cl_async = *(int *)val;
869 CDEBUG(D_HA, "%s: set async = %d\n",
870 exp->exp_obd->obd_name, cl->cl_async);
876 static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
877 unsigned long max_age)
879 struct obd_statfs *msfs;
880 struct ptlrpc_request *req;
881 int rc, size = sizeof(*msfs);
884 /* We could possibly pass max_age in the request (as an absolute
885 * timestamp or a "seconds.usec ago") so the target can avoid doing
886 * extra calls into the filesystem if that isn't necessary (e.g.
887 * during mount that would help a bit). Having relative timestamps
888 * is not so great if request processing is slow, while absolute
889 * timestamps are not ideal because they need time synchronization. */
890 req = ptlrpc_prep_req(obd->u.cli.cl_import, LUSTRE_MDS_VERSION,
891 MDS_STATFS, 0, NULL, NULL);
895 req->rq_replen = lustre_msg_size(1, &size);
897 mdc_get_rpc_lock(obd->u.cli.cl_rpc_lock, NULL);
898 rc = ptlrpc_queue_wait(req);
899 mdc_put_rpc_lock(obd->u.cli.cl_rpc_lock, NULL);
902 /* this can be LMV fake import, whcih is not connected. */
903 if (!req->rq_import->imp_connection)
904 memset(osfs, 0, sizeof(*osfs));
908 msfs = lustre_swab_repbuf(req, 0, sizeof(*msfs),
909 lustre_swab_obd_statfs);
911 CERROR("Can't unpack obd_statfs\n");
912 GOTO(out, rc = -EPROTO);
915 memcpy(osfs, msfs, sizeof (*msfs));
918 ptlrpc_req_finished(req);
922 static int mdc_pin(struct obd_export *exp, obd_id ino, __u32 gen, int type,
923 struct obd_client_handle *handle, int flag)
925 struct ptlrpc_request *req;
926 struct mds_body *body;
927 int rc, size[2] = {0, sizeof(*body)};
930 //size[0] = lustre_secdesc_size();
932 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
933 MDS_PIN, 2, size, NULL);
937 //lustre_pack_secdesc(req, size[0]);
939 body = lustre_msg_buf(req->rq_reqmsg,
940 MDS_REQ_REC_OFF, sizeof(*body));
942 /* FIXME-UMKA: here should be also mdsnum and fid. */
943 mdc_pack_id(&body->id1, ino, gen, type, 0, 0);
946 req->rq_replen = lustre_msg_size(1, &size[1]);
948 mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
949 rc = ptlrpc_queue_wait(req);
950 mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
952 CERROR("pin failed: %d\n", rc);
953 ptlrpc_req_finished(req);
957 body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
959 ptlrpc_req_finished(req);
963 memcpy(&handle->och_fh, &body->handle, sizeof(body->handle));
964 handle->och_magic = OBD_CLIENT_HANDLE_MAGIC;
966 OBD_ALLOC(handle->och_mod, sizeof(*handle->och_mod));
967 if (handle->och_mod == NULL) {
968 DEBUG_REQ(D_ERROR, req, "can't allocate mdc_open_data");
971 handle->och_mod->mod_open_req = req; /* will be dropped by unpin */
976 static int mdc_unpin(struct obd_export *exp,
977 struct obd_client_handle *handle, int flag)
979 struct ptlrpc_request *req;
980 struct mds_body *body;
981 int rc, size[2] = {0, sizeof(*body)};
984 if (handle->och_magic != OBD_CLIENT_HANDLE_MAGIC)
987 //size[0] = lustre_secdesc_size();
989 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
990 MDS_CLOSE, 2, size, NULL);
994 //lustre_pack_secdesc(req, size[0]);
996 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
997 memcpy(&body->handle, &handle->och_fh, sizeof(body->handle));
1000 req->rq_replen = lustre_msg_size(0, NULL);
1001 mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
1002 rc = ptlrpc_queue_wait(req);
1003 mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
1006 CERROR("unpin failed: %d\n", rc);
1008 ptlrpc_req_finished(req);
1009 ptlrpc_req_finished(handle->och_mod->mod_open_req);
1010 OBD_FREE(handle->och_mod, sizeof(*handle->och_mod));
1014 int mdc_sync(struct obd_export *exp, struct lustre_id *id,
1015 struct ptlrpc_request **request)
1017 struct ptlrpc_request *req;
1018 struct mds_body *body;
1019 int size[2] = {0, sizeof(*body)};
1023 //size[0] = lustre_secdesc_size();
1025 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
1026 MDS_SYNC, 2, size, NULL);
1028 RETURN(rc = -ENOMEM);
1030 //lustre_pack_secdesc(req, size[0]);
1033 body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
1035 memcpy(&body->id1, id, sizeof(*id));
1038 req->rq_replen = lustre_msg_size(1, &size[1]);
1040 rc = ptlrpc_queue_wait(req);
1041 if (rc || request == NULL)
1042 ptlrpc_req_finished(req);
1049 static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
1050 enum obd_import_event event)
1054 LASSERT(imp->imp_obd == obd);
1057 case IMP_EVENT_DISCON: {
1060 case IMP_EVENT_INACTIVE: {
1061 if (obd->obd_observer)
1062 rc = obd_notify(obd->obd_observer, obd, 0, 0);
1065 case IMP_EVENT_INVALIDATE: {
1066 struct ldlm_namespace *ns = obd->obd_namespace;
1068 ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
1072 case IMP_EVENT_ACTIVE: {
1073 if (obd->obd_observer)
1074 rc = obd_notify(obd->obd_observer, obd, 1, 0);
1078 CERROR("Unknown import event %d\n", event);
1084 static int mdc_attach(struct obd_device *dev, obd_count len, void *data)
1086 struct lprocfs_static_vars lvars;
1088 lprocfs_init_vars(mdc, &lvars);
1089 return lprocfs_obd_attach(dev, lvars.obd_vars);
1092 static int mdc_detach(struct obd_device *dev)
1094 return lprocfs_obd_detach(dev);
1097 static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
1099 struct client_obd *cli = &obd->u.cli;
1103 OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1104 if (!cli->cl_rpc_lock)
1106 mdc_init_rpc_lock(cli->cl_rpc_lock);
1110 OBD_ALLOC(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1111 if (!cli->cl_setattr_lock)
1112 GOTO(err_rpc_lock, rc = -ENOMEM);
1113 mdc_init_rpc_lock(cli->cl_setattr_lock);
1115 OBD_ALLOC(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1116 if (!cli->cl_close_lock)
1117 GOTO(err_setattr_lock, rc = -ENOMEM);
1118 mdc_init_rpc_lock(cli->cl_close_lock);
1120 rc = client_obd_setup(obd, len, buf);
1122 GOTO(err_close_lock, rc);
1124 rc = obd_llog_init(obd, &obd->obd_llogs, obd, 0, NULL);
1126 mdc_cleanup(obd, 0);
1127 CERROR("failed to setup llogging subsystems\n");
1133 OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1135 OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1137 OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1142 static int mdc_init_ea_size(struct obd_export *exp, int easize, int cookiesize)
1144 struct obd_device *obd = exp->exp_obd;
1145 struct client_obd *cli = &obd->u.cli;
1148 if (cli->cl_max_mds_easize < easize)
1149 cli->cl_max_mds_easize = easize;
1150 if (cli->cl_max_mds_cookiesize < cookiesize)
1151 cli->cl_max_mds_cookiesize = cookiesize;
1155 static int mdc_precleanup(struct obd_device *obd, int flags)
1159 rc = obd_llog_finish(obd, &obd->obd_llogs, 0);
1161 CERROR("failed to cleanup llogging subsystems\n");
1166 static int mdc_cleanup(struct obd_device *obd, int flags)
1168 struct client_obd *cli = &obd->u.cli;
1170 OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
1171 OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
1172 OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
1176 return client_obd_cleanup(obd, flags);
1180 static int mdc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
1181 struct obd_device *tgt, int count,
1182 struct llog_catid *logid)
1184 struct llog_ctxt *ctxt;
1188 rc = obd_llog_setup(obd, llogs, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL,
1191 ctxt = llog_get_context(llogs, LLOG_CONFIG_REPL_CTXT);
1192 ctxt->loc_imp = obd->u.cli.cl_import;
1198 static int mdc_llog_finish(struct obd_device *obd,
1199 struct obd_llogs *llogs, int count)
1204 rc = obd_llog_cleanup(llog_get_context(llogs, LLOG_CONFIG_REPL_CTXT));
1207 static struct obd_device *mdc_get_real_obd(struct obd_export *exp,
1208 struct lustre_id *id)
1211 RETURN(exp->exp_obd);
1214 static int mdc_get_info(struct obd_export *exp, obd_count keylen,
1215 void *key, __u32 *valsize, void *val)
1217 struct ptlrpc_request *req;
1218 char *bufs[1] = {key};
1222 if (!valsize || !val)
1225 if (keylen == strlen("remote_flag") && !strcmp(key, "remote_flag")) {
1226 struct obd_import *imp;
1227 struct obd_connect_data *data;
1229 imp = class_exp2cliimp(exp);
1235 if (imp->imp_state != LUSTRE_IMP_FULL) {
1236 CERROR("import state not full\n");
1240 data = &imp->imp_connect_data;
1241 if (data->ocd_connect_flags & OBD_CONNECT_REMOTE) {
1244 } else if (data->ocd_connect_flags & OBD_CONNECT_LOCAL) {
1248 CERROR("no remote flag set?\n");
1252 if ((keylen < strlen("mdsize") || strcmp(key, "mdsize") != 0) &&
1253 (keylen < strlen("mdsnum") || strcmp(key, "mdsnum") != 0) &&
1254 (keylen < strlen("rootid") || strcmp(key, "rootid") != 0))
1257 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
1258 OST_GET_INFO, 1, &keylen, bufs);
1262 req->rq_replen = lustre_msg_size(1, valsize);
1263 rc = ptlrpc_queue_wait(req);
1267 if (keylen >= strlen("rootid") && !strcmp(key, "rootid")) {
1268 struct lustre_id *reply;
1270 reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
1271 lustre_swab_lustre_id);
1272 if (reply == NULL) {
1273 CERROR("Can't unpack %s\n", (char *)key);
1274 GOTO(out_req, rc = -EPROTO);
1277 *(struct lustre_id *)val = *reply;
1281 reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
1282 lustre_swab_generic_32s);
1283 if (reply == NULL) {
1284 CERROR("Can't unpack %s\n", (char *)key);
1285 GOTO(out_req, rc = -EPROTO);
1287 *((__u32 *)val) = *reply;
1290 ptlrpc_req_finished(req);
1294 int mdc_obj_create(struct obd_export *exp, struct obdo *oa,
1295 struct lov_stripe_md **ea, struct obd_trans_info *oti)
1297 struct ptlrpc_request *request;
1298 struct ost_body *body;
1299 int rc, size = sizeof(*body);
1304 request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
1305 OST_CREATE, 1, &size, NULL);
1307 GOTO(out_req, rc = -ENOMEM);
1309 body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof (*body));
1310 memcpy(&body->oa, oa, sizeof(body->oa));
1312 request->rq_replen = lustre_msg_size(1, &size);
1313 rc = ptlrpc_queue_wait(request);
1317 body = lustre_swab_repbuf(request, 0, sizeof(*body),
1318 lustre_swab_ost_body);
1320 CERROR ("can't unpack ost_body\n");
1321 GOTO (out_req, rc = -EPROTO);
1324 memcpy(oa, &body->oa, sizeof(*oa));
1326 /* store ino/generation for recovery */
1327 body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof (*body));
1328 body->oa.o_id = oa->o_id;
1329 body->oa.o_generation = oa->o_generation;
1330 body->oa.o_fid = oa->o_fid;
1331 body->oa.o_mds = oa->o_mds;
1333 CDEBUG(D_HA, "transno: "LPD64"\n", request->rq_repmsg->transno);
1336 ptlrpc_req_finished(request);
1340 int mdc_brw(int rw, struct obd_export *exp, struct obdo *oa,
1341 struct lov_stripe_md *ea, obd_count oa_bufs,
1342 struct brw_page *pgarr, struct obd_trans_info *oti)
1344 struct ptlrpc_bulk_desc *desc;
1345 struct niobuf_remote *niobuf;
1346 struct ptlrpc_request *req;
1347 struct obd_ioobj *ioobj;
1348 struct ost_body *body;
1352 opc = ((rw & OBD_BRW_WRITE) != 0) ? OST_WRITE : OST_READ;
1354 size[0] = sizeof(*body);
1355 size[1] = sizeof(*ioobj);
1356 size[2] = oa_bufs * sizeof(*niobuf);
1358 req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION, opc,
1360 LASSERT(req != NULL);
1362 if (opc == OST_WRITE)
1363 desc = ptlrpc_prep_bulk_imp(req, oa_bufs, BULK_GET_SOURCE,
1366 desc = ptlrpc_prep_bulk_imp(req, oa_bufs, BULK_PUT_SINK,
1368 LASSERT(desc != NULL);
1370 body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
1371 ioobj = lustre_msg_buf(req->rq_reqmsg, 1, sizeof(*ioobj));
1372 niobuf = lustre_msg_buf(req->rq_reqmsg, 2, oa_bufs * sizeof(*niobuf));
1374 memcpy(&body->oa, oa, sizeof(*oa));
1375 obdo_to_ioobj(oa, ioobj);
1376 ioobj->ioo_bufcnt = oa_bufs;
1378 for (i = 0; i < oa_bufs; i++, niobuf++) {
1379 struct brw_page *pg = &pgarr[i];
1381 LASSERT(pg->count > 0);
1382 LASSERT((pg->disk_offset & ~PAGE_MASK) + pg->count <= PAGE_SIZE);
1384 ptlrpc_prep_bulk_page(desc, pg->pg, pg->disk_offset & ~PAGE_MASK,
1387 niobuf->offset = pg->disk_offset;
1388 niobuf->len = pg->count;
1389 niobuf->flags = pg->flag;
1392 /* size[0] still sizeof (*body) */
1393 if (opc == OST_WRITE) {
1394 /* 1 RC per niobuf */
1395 size[1] = sizeof(__u32) * oa_bufs;
1396 req->rq_replen = lustre_msg_size(2, size);
1398 /* 1 RC for the whole I/O */
1399 req->rq_replen = lustre_msg_size(1, size);
1401 err = ptlrpc_queue_wait(req);
1404 ptlrpc_req_finished(req);
1408 static int mdc_valid_attrs(struct obd_export *exp,
1409 struct lustre_id *id)
1411 struct ldlm_res_id res_id = { .name = {0} };
1412 struct obd_device *obd = exp->exp_obd;
1413 struct lustre_handle lockh;
1414 ldlm_policy_data_t policy;
1418 res_id.name[0] = id_fid(id);
1419 res_id.name[1] = id_group(id);
1420 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
1422 CDEBUG(D_INFO, "trying to match res "LPU64"\n",
1425 /* FIXME use LDLM_FL_TEST_LOCK instead */
1426 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING;
1427 if (ldlm_lock_match(obd->obd_namespace, flags, &res_id,
1428 LDLM_IBITS, &policy, LCK_PR, &lockh)) {
1429 ldlm_lock_decref(&lockh, LCK_PR);
1433 if (ldlm_lock_match(obd->obd_namespace, flags, &res_id,
1434 LDLM_IBITS, &policy, LCK_PW, &lockh)) {
1435 ldlm_lock_decref(&lockh, LCK_PW);
1441 static int mdc_change_cbdata_name(struct obd_export *exp,
1442 struct lustre_id *pid,
1443 char *name, int len,
1444 struct lustre_id *cid,
1445 ldlm_iterator_t it, void *data)
1448 rc = mdc_change_cbdata(exp, cid, it, data);
1452 struct obd_ops mdc_obd_ops = {
1453 .o_owner = THIS_MODULE,
1454 .o_attach = mdc_attach,
1455 .o_detach = mdc_detach,
1456 .o_setup = mdc_setup,
1457 .o_precleanup = mdc_precleanup,
1458 .o_cleanup = mdc_cleanup,
1459 .o_add_conn = client_import_add_conn,
1460 .o_del_conn = client_import_del_conn,
1461 .o_connect = client_connect_import,
1462 .o_disconnect = client_disconnect_export,
1463 .o_iocontrol = mdc_iocontrol,
1464 .o_packmd = mdc_packmd,
1465 .o_unpackmd = mdc_unpackmd,
1466 .o_statfs = mdc_statfs,
1468 .o_unpin = mdc_unpin,
1469 .o_import_event = mdc_import_event,
1470 .o_llog_init = mdc_llog_init,
1471 .o_llog_finish = mdc_llog_finish,
1472 .o_create = mdc_obj_create,
1473 .o_set_info = mdc_set_info,
1474 .o_get_info = mdc_get_info,
1476 .o_init_ea_size = mdc_init_ea_size,
1479 struct md_ops mdc_md_ops = {
1480 .m_getstatus = mdc_getstatus,
1481 .m_getattr = mdc_getattr,
1482 .m_close = mdc_close,
1483 .m_create = mdc_create,
1484 .m_done_writing = mdc_done_writing,
1485 .m_enqueue = mdc_enqueue,
1486 .m_getattr_lock = mdc_getattr_lock,
1487 .m_intent_lock = mdc_intent_lock,
1489 .m_rename = mdc_rename,
1490 .m_setattr = mdc_setattr,
1492 .m_readpage = mdc_readpage,
1493 .m_unlink = mdc_unlink,
1494 .m_valid_attrs = mdc_valid_attrs,
1495 .m_req2lustre_md = mdc_req2lustre_md,
1496 .m_set_open_replay_data = mdc_set_open_replay_data,
1497 .m_clear_open_replay_data = mdc_clear_open_replay_data,
1498 .m_store_inode_generation = mdc_store_inode_generation,
1499 .m_set_lock_data = mdc_set_lock_data,
1500 .m_get_real_obd = mdc_get_real_obd,
1501 .m_change_cbdata_name = mdc_change_cbdata_name,
1502 .m_change_cbdata = mdc_change_cbdata,
1505 int __init mdc_init(void)
1507 struct lprocfs_static_vars lvars;
1508 lprocfs_init_vars(mdc, &lvars);
1509 return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
1514 static void /*__exit*/ mdc_exit(void)
1516 class_unregister_type(LUSTRE_MDC_NAME);
1519 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
1520 MODULE_DESCRIPTION("Lustre Metadata Client");
1521 MODULE_LICENSE("GPL");
1523 EXPORT_SYMBOL(mdc_req2lustre_md);
1524 EXPORT_SYMBOL(mdc_change_cbdata);
1525 EXPORT_SYMBOL(mdc_getstatus);
1526 EXPORT_SYMBOL(mdc_getattr);
1527 EXPORT_SYMBOL(mdc_getattr_lock);
1528 EXPORT_SYMBOL(mdc_create);
1529 EXPORT_SYMBOL(mdc_unlink);
1530 EXPORT_SYMBOL(mdc_rename);
1531 EXPORT_SYMBOL(mdc_link);
1532 EXPORT_SYMBOL(mdc_readpage);
1533 EXPORT_SYMBOL(mdc_setattr);
1534 EXPORT_SYMBOL(mdc_close);
1535 EXPORT_SYMBOL(mdc_done_writing);
1536 EXPORT_SYMBOL(mdc_sync);
1537 EXPORT_SYMBOL(mdc_set_open_replay_data);
1538 EXPORT_SYMBOL(mdc_clear_open_replay_data);
1539 EXPORT_SYMBOL(mdc_store_inode_generation);
1541 module_init(mdc_init);
1542 module_exit(mdc_exit);