Whamcloud - gitweb
Remove no-longer-needed inode operations (they previously had extN EA VFS
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index 3235088..4be6294 100644 (file)
  *
  * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
  *
- *   This file is part of Portals, http://www.sf.net/projects/lustre/
+ *   This file is part of Lustre, http://www.sf.net/projects/lustre/
  *
- *   Portals is free software; you can redistribute it and/or
+ *   Lustre is free software; you can redistribute it and/or
  *   modify it under the terms of version 2 of the GNU General Public
  *   License as published by the Free Software Foundation.
  *
- *   Portals is distributed in the hope that it will be useful,
+ *   Lustre is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
  *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
+ *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
 
 #define EXPORT_SYMTAB
 
-#include <linux/config.h>
 #include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
 #include <linux/miscdevice.h>
 
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
+#define DEBUG_SUBSYSTEM S_MDC
+
 #include <linux/lustre_mds.h>
+#include <linux/lustre_lite.h>
 
 #define REQUEST_MINOR 244
 
 extern int mds_queue_req(struct ptlrpc_request *);
 
-/* FIXME: this belongs in some sort of service struct */
-static int mdc_xid = 0;
-
-struct ptlrpc_request *mds_prep_req(int opcode, int namelen, char *name,
-                                    int tgtlen, char *tgt)
+int mdc_connect(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+                struct ll_fid *rootfid, __u64 *last_committed, __u64 *last_rcvd,
+                __u32 *last_xid, struct ptlrpc_request **request)
 {
-       struct ptlrpc_request *request;
-       int rc;
-       ENTRY; 
-
-       OBD_ALLOC(request, sizeof(*request));
-       if (!request) { 
-               printk("mds_prep_req: request allocation out of memory\n");
-               return NULL;
-       }
-
-       memset(request, 0, sizeof(*request));
-       request->rq_xid = mdc_xid++;
-
-       rc = mds_pack_req(name, namelen, tgt, tgtlen,
-                         &request->rq_reqhdr, &(request->rq_req.mds),
-                         &request->rq_reqlen, &request->rq_reqbuf);
-       if (rc) { 
-               printk("llight request: cannot pack request %d\n", rc); 
-               return NULL;
-       }
-        CDEBUG(D_MDC, "--> mds_prep_req: len %d, req %p, tgtlen %d\n", 
-              request->rq_reqlen, request->rq_req.mds, 
-              request->rq_req.mds->tgtlen);
-       request->rq_reqhdr->opc = opcode;
-
-       EXIT;
-       return request;
-}
+        struct ptlrpc_request *req;
+        struct mds_body *body;
+        int rc, size = sizeof(*body);
+        ENTRY;
+
+        req = ptlrpc_prep_req(cl, conn, MDS_CONNECT, 1, &size, NULL);
+        if (!req)
+                GOTO(out, rc = -ENOMEM);
+
+        body = lustre_msg_buf(req->rq_reqmsg, 0);
+        req->rq_level = LUSTRE_CONN_CON;
+        req->rq_replen = lustre_msg_size(1, &size);
+
+        mds_pack_req_body(req);
+        rc = ptlrpc_queue_wait(req);
+        rc = ptlrpc_check_status(req, rc);
+
+        if (!rc) {
+                mds_unpack_rep_body(req);
+                body = lustre_msg_buf(req->rq_repmsg, 0);
+                memcpy(rootfid, &body->fid1, sizeof(*rootfid));
+                *last_committed = req->rq_repmsg->last_committed;
+                *last_rcvd = req->rq_repmsg->last_rcvd;
+                *last_xid = body->last_xid;
+
+                CDEBUG(D_NET, "root ino=%ld, last_committed=%Lu, last_rcvd=%Lu,"
+                       " last_xid=%d\n",
+                       (unsigned long)rootfid->id,
+                       (unsigned long long)*last_committed,
+                       (unsigned long long)*last_rcvd,
+                       body->last_xid);
+        }
 
-static int mds_queue_wait(struct ptlrpc_request *req, struct lustre_peer *peer)
-{
-       int rc;
-
-       /* XXX fix the race here (wait_for_event?)*/
-       if (peer == NULL) {
-               /* Local delivery */
-                ENTRY;
-               rc = mds_queue_req(req); 
-       } else {
-               /* Remote delivery via portals. */
-               req->rq_req_portal = MDS_REQUEST_PORTAL;
-               req->rq_reply_portal = MDS_REPLY_PORTAL;
-               rc = ptl_send_rpc(req, peer);
-       }
-       if (rc) { 
-               printk(__FUNCTION__ ": error %d, opcode %d\n", rc, 
-                      req->rq_reqhdr->opc); 
-               return -rc;
-       }
-
-       init_waitqueue_head(&req->rq_wait_for_rep);
-        CDEBUG(D_MDC, "-- sleeping\n");
-       interruptible_sleep_on(&req->rq_wait_for_rep);
-        CDEBUG(D_MDC, "-- done\n");
-
-       rc = mds_unpack_rep(req->rq_repbuf, req->rq_replen, &req->rq_rephdr, 
-                           &req->rq_rep.mds);
-       if (rc) {
-               printk(__FUNCTION__ ": mds_unpack_rep failed: %d\n", rc);
-               return rc;
-       }
-
-       if ( req->rq_rephdr->status == 0 )
-                CDEBUG(D_MDC, "--> buf %p len %d status %d\n",
-                      req->rq_repbuf, req->rq_replen, 
-                      req->rq_rephdr->status); 
-
-       EXIT;
-       return 0;
+        EXIT;
+ out:
+        ptlrpc_free_req(req); 
+        return rc;
 }
 
-void mdc_free_req(struct ptlrpc_request *request)
-{
-       OBD_FREE(request, sizeof(*request));
-}
 
-int mdc_getattr(struct lustre_peer *peer, ino_t ino, int type, int valid, 
-               struct mds_rep  **rep, struct ptlrep_hdr **hdr)
+int mdc_getattr(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+                ino_t ino, int type, unsigned long valid, size_t ea_size,
+                struct ptlrpc_request **request)
 {
-       struct ptlrpc_request *request;
-       int rc; 
-
-       request = mds_prep_req(MDS_GETATTR, 0, NULL, 0, NULL); 
-       if (!request) { 
-               printk("llight request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       ll_ino2fid(&request->rq_req.mds->fid1, ino, 0, type);
-
-       request->rq_req.mds->valid = valid;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = mds_queue_wait(request, peer);
-       if (rc) { 
-               printk("llight request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-        CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
- out: 
-       mdc_free_req(request);
-       return rc;
+        struct ptlrpc_request *req;
+        struct mds_body *body;
+        int rc, size[2] = {sizeof(*body), 0}, bufcount = 1;
+        ENTRY;
+
+        req = ptlrpc_prep_req(cl, conn, MDS_GETATTR, 1, size, NULL);
+        if (!req)
+                GOTO(out, rc = -ENOMEM);
+
+        body = lustre_msg_buf(req->rq_reqmsg, 0);
+        ll_ino2fid(&body->fid1, ino, 0, type);
+        body->valid = valid;
+
+        if (valid & OBD_MD_LINKNAME) {
+                bufcount = 2;
+                size[1] = ea_size;
+        }
+        req->rq_replen = lustre_msg_size(bufcount, size);
+        req->rq_level = LUSTRE_CONN_FULL;
+
+        rc = ptlrpc_queue_wait(req);
+        rc = ptlrpc_check_status(req, rc);
+
+        if (!rc) {
+                mds_unpack_rep_body(req);
+                body = lustre_msg_buf(req->rq_repmsg, 0);
+                CDEBUG(D_NET, "mode: %o\n", body->mode);
+        }
+
+        EXIT;
+ out:
+        *request = req;
+        return rc;
 }
 
-int mdc_readpage(struct lustre_peer *peer, ino_t ino, int type, __u64 offset,
-                char *addr, struct mds_rep  **rep, struct ptlrep_hdr **hdr)
+int mdc_open(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+             ino_t ino, int type, int flags, __u64 cookie, __u64 *fh,
+             struct ptlrpc_request **request)
 {
-       struct ptlrpc_request *request;
-       struct niobuf niobuf;
-       int rc; 
-
-       niobuf.addr = (__u64) (long) addr;
-
-        CDEBUG(D_MDC, "inode: %ld\n", ino);
-
-       request = mds_prep_req(MDS_READPAGE, 0, NULL,
-                              sizeof(struct niobuf), (char *)&niobuf);
-       if (!request) { 
-               printk("mdc request: cannot pack\n");
-               return -ENOMEM;
-       }
-
-       request->rq_req.mds->fid1.id = ino;
-       request->rq_req.mds->fid1.f_type = type;
-       request->rq_req.mds->size = offset;
-       request->rq_req.mds->tgtlen = sizeof(niobuf); 
-
-       request->rq_bulk_portal = MDS_BULK_PORTAL;
-       request->rq_replen = 
-               sizeof(struct ptlrep_hdr) + sizeof(struct mds_rep);
-
-       rc = mds_queue_wait(request, peer);
-       if (rc) { 
-               printk("mdc request: error in handling %d\n", rc); 
-               goto out;
-       }
-
-        CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode);
-
-       if (rep) { 
-               *rep = request->rq_rep.mds;
-       }
-       if (hdr) { 
-               *hdr = request->rq_rephdr;
-       }
-
- out: 
-       mdc_free_req(request);
-       return rc;
+        struct mds_body *body;
+        int rc, size = sizeof(*body);
+        struct ptlrpc_request *req;
+
+        req = ptlrpc_prep_req(cl, conn, MDS_OPEN, 1, &size, NULL);
+        if (!req)
+                GOTO(out, rc = -ENOMEM);
+
+        req->rq_flags |= PTL_RPC_FL_REPLAY;
+        req->rq_level = LUSTRE_CONN_FULL;
+        body = lustre_msg_buf(req->rq_reqmsg, 0);
+        ll_ino2fid(&body->fid1, ino, 0, type);
+        body->flags = HTON__u32(flags);
+        body->objid = cookie; 
+
+        req->rq_replen = lustre_msg_size(1, &size);
+
+        rc = ptlrpc_queue_wait(req);
+        rc = ptlrpc_check_status(req, rc);
+
+        if (!rc) {
+                mds_unpack_rep_body(req);
+                body = lustre_msg_buf(req->rq_repmsg, 0);
+                *fh = body->objid;
+        }
+
+        EXIT;
+ out:
+        *request = req;
+        return rc;
 }
 
-int mdc_reint(struct lustre_peer *peer, struct ptlrpc_request *request)
+int mdc_close(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+              ino_t ino, int type, __u64 fh, struct ptlrpc_request **request)
 {
-       int rc; 
+        struct mds_body *body;
+        int rc, size = sizeof(*body);
+        struct ptlrpc_request *req;
+
+        req = ptlrpc_prep_req(cl, conn, MDS_CLOSE, 1, &size, NULL);
+        if (!req)
+                GOTO(out, rc = -ENOMEM);
 
-       rc = mds_queue_wait(request, peer);
-       if (rc) { 
-               printk("mdc request: error in handling %d\n", rc); 
-       }
+        body = lustre_msg_buf(req->rq_reqmsg, 0);
+        ll_ino2fid(&body->fid1, ino, 0, type);
+        body->objid = fh;
 
-       return rc;
+        req->rq_level = LUSTRE_CONN_FULL;
+        req->rq_replen = lustre_msg_size(0, NULL);
+
+        rc = ptlrpc_queue_wait(req);
+        rc = ptlrpc_check_status(req, rc);
+
+        EXIT;
+ out:
+        *request = req;
+        return rc;
 }
 
+int mdc_readpage(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+                 ino_t ino, int type, __u64 offset, char *addr,
+                 struct ptlrpc_request **request)
+{
+        struct ptlrpc_request *req = NULL;
+        struct ptlrpc_bulk_desc *desc = NULL;
+        struct ptlrpc_bulk_page *bulk = NULL;
+        struct mds_body *body;
+        int rc, size = sizeof(*body);
+        ENTRY;
+
+        CDEBUG(D_INODE, "inode: %ld\n", (long)ino);
+
+        desc = ptlrpc_prep_bulk(conn);
+        if (desc == NULL)
+                GOTO(out, rc = -ENOMEM);
+
+        req = ptlrpc_prep_req(cl, conn, MDS_READPAGE, 1, &size, NULL);
+        if (!req)
+                GOTO(out2, rc = -ENOMEM);
+
+        bulk = ptlrpc_prep_bulk_page(desc);
+        bulk->b_buflen = PAGE_SIZE;
+        bulk->b_buf = addr;
+        bulk->b_xid = req->rq_reqmsg->xid;
+        desc->b_portal = MDS_BULK_PORTAL;
+
+        rc = ptlrpc_register_bulk(desc);
+        if (rc) {
+                CERROR("couldn't setup bulk sink: error %d.\n", rc);
+                GOTO(out2, rc);
+        }
+
+        body = lustre_msg_buf(req->rq_reqmsg, 0);
+        body->fid1.id = ino;
+        body->fid1.f_type = type;
+        body->size = offset;
+
+        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_level = LUSTRE_CONN_FULL;
+        rc = ptlrpc_queue_wait(req);
+        if (rc) {
+                CERROR("error in handling %d\n", rc);
+                ptlrpc_abort_bulk(desc);
+        } else
+                mds_unpack_rep_body(req);
+
+        EXIT;
+ out2:
+        ptlrpc_free_bulk(desc);
+ out:
+        *request = req;
+        return rc;
+}
 
-static int request_ioctl(struct inode *inode, struct file *file, 
+static int request_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long arg)
 {
-       int err;
-       struct lustre_peer peer, *peer_ptr = NULL;
+        int err = 0;
+        struct ptlrpc_client cl;
+        struct ptlrpc_connection *conn;
+        struct ptlrpc_request *request;
 
-       ENTRY;
+        ENTRY;
 
-       if (MINOR(inode->i_rdev) != REQUEST_MINOR) {
-               EXIT;
-               return -EINVAL;
-       }
+        if (MINOR(inode->i_rdev) != REQUEST_MINOR)
+                RETURN(-EINVAL);
 
-       if ( _IOC_TYPE(cmd) != IOC_REQUEST_TYPE || 
-             _IOC_NR(cmd) < IOC_REQUEST_MIN_NR  || 
-             _IOC_NR(cmd) > IOC_REQUEST_MAX_NR ) {
+        if (_IOC_TYPE(cmd) != IOC_REQUEST_TYPE ||
+            _IOC_NR(cmd) < IOC_REQUEST_MIN_NR  ||
+            _IOC_NR(cmd) > IOC_REQUEST_MAX_NR ) {
                 CDEBUG(D_IOCTL, "invalid ioctl ( type %d, nr %d, size %d )\n",
-                                _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
-                EXIT;
-                return -EINVAL;
+                       _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
+                RETURN(-EINVAL);
+        }
+
+        ptlrpc_init_client(NULL, NULL, 
+                           MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL, &cl);
+        conn = ptlrpc_uuid_to_connection("mds");
+        if (!conn) {
+                CERROR("cannot create client\n");
+                RETURN(-EINVAL);
+        }
+
+        switch (cmd) {
+        case IOC_REQUEST_GETATTR: {
+                CERROR("-- getting attr for ino %lu\n", arg);
+                err = mdc_getattr(&cl, conn, arg, S_IFDIR, ~0, 0, &request);
+                CERROR("-- done err %d\n", err);
+
+                GOTO(out, err);
         }
 
-       err = kportal_uuid_to_peer("mds", &peer);
-       if (err == 0)
-               peer_ptr = &peer;
-       
-       switch (cmd) {
-       case IOC_REQUEST_GETATTR: { 
-               struct ptlrep_hdr *hdr = NULL;
-               printk("-- getting attr for ino 2\n"); 
-               err = mdc_getattr(peer_ptr, 2, S_IFDIR, ~0, NULL, &hdr);
-               if (hdr) {
-                        /* FIXME: there must be a better way to get the size */
-                       OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                 sizeof(struct mds_rep));
+        case IOC_REQUEST_READPAGE: {
+                char *buf;
+                OBD_ALLOC(buf, PAGE_SIZE);
+                if (!buf) {
+                        err = -ENOMEM;
+                        GOTO(out, err);
                 }
-               printk("-- done err %d\n", err);
-               break;
-       }
-
-       case IOC_REQUEST_READPAGE: { 
-               struct ptlrep_hdr *hdr = NULL;
-               char *buf;
-               OBD_ALLOC(buf, PAGE_SIZE);
-               if (!buf) { 
-                       err = -ENOMEM;
-                       break;
-               }
-               printk("-- readpage 0 for ino 2\n"); 
-               err = mdc_readpage(peer_ptr, 2, S_IFDIR, 0, buf, NULL, &hdr);
-               printk("-- done err %d\n", err);
-               if (!err) { 
-                       printk("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-                        if (hdr)
-                                OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                         sizeof(struct mds_rep));
-               }
-               OBD_FREE(buf, PAGE_SIZE);
-               break;
-       }
-
-       case IOC_REQUEST_SETATTR: { 
-               struct inode inode;
-               struct ptlrep_hdr *hdr;
-               struct iattr iattr; 
-
-               inode.i_ino = 2;
-               iattr.ia_mode = 040777;
-               iattr.ia_atime = 0;
-               iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
-
-               err = mdc_setattr(peer_ptr, &inode, &iattr, NULL, &hdr);
-               printk("-- done err %d\n", err);
-               if (!err) { 
-                       printk("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-               } else {
-                        OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                                 sizeof(struct mds_rep));
-               }
-               break;
-       }
-
-       case IOC_REQUEST_CREATE: { 
-               struct inode inode;
-               struct ptlrep_hdr *hdr;
-               struct iattr iattr; 
-
-               inode.i_ino = 2;
-               iattr.ia_mode = 040777;
-               iattr.ia_atime = 0;
-               iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
-
-               err = mdc_create(peer_ptr, &inode, 
-                                "foofile", strlen("foofile"), 
-                                NULL, 0, 0100707, 47114711, 
-                                11, 47, 0, NULL, &hdr);
-               printk("-- done err %d\n", err);
-               if (!err) { 
-                       printk("-- status: %d\n", hdr->status); 
-                       err = hdr->status;
-               }
-                OBD_FREE(hdr, sizeof(struct ptlrep_hdr) +
-                         sizeof(struct mds_rep));
-               break;
-       }
-
-       default:                
-               err = -EINVAL;
-               EXIT;
-               break;
-       }
-       EXIT;
-       return err;
+                CERROR("-- readpage 0 for ino %lu\n", arg);
+                err = mdc_readpage(&cl, conn, arg, S_IFDIR, 0, buf, &request);
+                CERROR("-- done err %d\n", err);
+                OBD_FREE(buf, PAGE_SIZE);
+
+                GOTO(out, err);
+        }
+
+        case IOC_REQUEST_SETATTR: {
+                struct inode inode;
+                struct iattr iattr;
+
+                inode.i_ino = arg;
+                inode.i_generation = 0;
+                iattr.ia_mode = 040777;
+                iattr.ia_atime = 0;
+                iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
+
+                err = mdc_setattr(&cl, conn, &inode, &iattr, &request);
+                CERROR("-- done err %d\n", err);
+
+                GOTO(out, err);
+        }
+
+        case IOC_REQUEST_CREATE: {
+                struct inode inode;
+                struct iattr iattr;
+
+                inode.i_ino = arg;
+                inode.i_generation = 0;
+                iattr.ia_mode = 040777;
+                iattr.ia_atime = 0;
+                iattr.ia_valid = ATTR_MODE | ATTR_ATIME;
+
+                err = mdc_create(&cl, conn, &inode,
+                                 "foofile", strlen("foofile"),
+                                 NULL, 0, 0100707, 47114711,
+                                 11, 47, 0, &request);
+                CERROR("-- done err %d\n", err);
+
+                GOTO(out, err);
+        }
+
+        case IOC_REQUEST_OPEN: {
+                __u64 fh, ino;
+                copy_from_user(&ino, (__u64 *)arg, sizeof(ino));
+                CERROR("-- opening ino %llu\n", (unsigned long long)ino);
+                err = mdc_open(&cl, conn, ino, S_IFDIR, O_RDONLY, 4711, &fh, 
+                               &request);
+                copy_to_user((__u64 *)arg, &fh, sizeof(fh));
+                CERROR("-- done err %d (fh=%Lu)\n", err,
+                       (unsigned long long)fh);
+
+                GOTO(out, err);
+        }
+
+        case IOC_REQUEST_CLOSE: {
+                CERROR("-- closing ino 2, filehandle %lu\n", arg);
+                err = mdc_close(&cl, conn, 2, S_IFDIR, arg, &request);
+                CERROR("-- done err %d\n", err);
+
+                GOTO(out, err);
+        }
+
+        default:
+                GOTO(out, err = -EINVAL);
+        }
+
+ out:
+        ptlrpc_free_req(request);
+        ptlrpc_put_connection(conn);
+        ptlrpc_cleanup_client(&cl);
+
+        RETURN(err);
 }
 
 
 static struct file_operations requestdev_fops = {
-       ioctl: request_ioctl,
+        ioctl: request_ioctl,
 };
 
-
 static struct miscdevice request_dev = {
-       REQUEST_MINOR,
-       "request",
-       &requestdev_fops
+        REQUEST_MINOR,
+        "request",
+        &requestdev_fops
 };
 
-
 static int __init ptlrpc_request_init(void)
 {
-       misc_register(&request_dev);
-        return 0 ;
+        misc_register(&request_dev);
+        return 0;
 }
 
-
 static void __exit ptlrpc_request_exit(void)
 {
-       misc_deregister(&request_dev);
+        misc_deregister(&request_dev);
 }
 
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre MDS Request Tester v1.0");
 MODULE_LICENSE("GPL");
 
-EXPORT_SYMBOL(mdc_create); 
-EXPORT_SYMBOL(mdc_unlink); 
-EXPORT_SYMBOL(mdc_rename); 
-EXPORT_SYMBOL(mdc_link); 
-EXPORT_SYMBOL(mdc_getattr); 
-EXPORT_SYMBOL(mdc_readpage); 
-EXPORT_SYMBOL(mdc_setattr); 
+EXPORT_SYMBOL(mdc_connect);
+EXPORT_SYMBOL(mdc_getattr);
+EXPORT_SYMBOL(mdc_create);
+EXPORT_SYMBOL(mdc_unlink);
+EXPORT_SYMBOL(mdc_rename);
+EXPORT_SYMBOL(mdc_link);
+EXPORT_SYMBOL(mdc_readpage);
+EXPORT_SYMBOL(mdc_setattr);
+EXPORT_SYMBOL(mdc_close);
+EXPORT_SYMBOL(mdc_open);
 
 module_init(ptlrpc_request_init);
 module_exit(ptlrpc_request_exit);