1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
5 * Author: Peter J. Braam <braam@clusterfs.com>
6 * Author: Phil Schwan <phil@clusterfs.com>
8 * This file is part of Lustre, http://www.lustre.org.
10 * Lustre is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Lustre is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with Lustre; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * Storage Target Handling functions
24 * Lustre Object Server Module (OST)
26 * This server is single threaded at present (but can easily be multi
27 * threaded). For testing and management it is treated as an
28 * obd_device, although it does not export a full OBD method table
29 * (the requests are coming in over the wire, so object target
30 * modules do not have a full method table.)
34 #define DEBUG_SUBSYSTEM S_OST
36 #include <linux/module.h>
37 #include <linux/obd_ost.h>
38 #include <linux/lustre_net.h>
39 #include <linux/lustre_dlm.h>
41 int target_handle_connect(struct ptlrpc_request *req)
43 struct obd_device *target;
44 struct obd_export *export;
45 struct lustre_handle conn;
50 uuid = lustre_msg_buf(req->rq_reqmsg, 0);
51 if (req->rq_reqmsg->buflens[0] > 37) {
53 req->rq_status = -EINVAL;
57 i = class_uuid2dev(uuid);
59 req->rq_status = -ENODEV;
65 req->rq_status = -ENODEV;
69 conn.addr = req->rq_reqmsg->addr;
70 conn.cookie = req->rq_reqmsg->cookie;
72 rc = lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
76 req->rq_status = obd_connect(&conn, target);
77 req->rq_repmsg->addr = conn.addr;
78 req->rq_repmsg->cookie = conn.cookie;
80 export = class_conn2export(&conn);
84 req->rq_export = export;
85 export->exp_connection = req->rq_connection;
86 #warning Peter: is this the right place to upgrade the server connection level?
87 req->rq_connection->c_level = LUSTRE_CONN_FULL;
91 int target_handle_disconnect(struct ptlrpc_request *req)
93 struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
97 rc = lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
101 req->rq_status = obd_disconnect(conn);