portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
- CDEBUG_STACK(), format , ## a); \
+ CDEBUG_STACK(), format, ## a); \
} while (0)
#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sighand->siglock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sighand->siglock, flags)
# define RECALC_SIGPENDING recalc_sigpending()
#else
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sigmask_lock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sigmask_lock, flags)
# define RECALC_SIGPENDING recalc_sigpending(current)
#endif
+
+#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+#else
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt, ## a)
+#endif
-/*
-*/
#ifndef _P30_INTERNAL_H_
#define _P30_INTERNAL_H_
#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
/*
* Simple doubly linked list implementation.
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
+#endif
+#ifndef list_for_each_entry
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
+#endif
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
/*
-*/
-/*
* stringtab.h
*/
#include <linux/lustre_mds.h>
#include <linux/lustre_net.h>
-int client_import_connect(struct lustre_handle *dlm_handle,
+int client_import_connect(struct lustre_handle *dlm_handle,
struct obd_device *obd,
struct obd_uuid *cluuid)
{
request->rq_level = LUSTRE_CONN_NEW;
request->rq_replen = lustre_msg_size(0, NULL);
+ lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_PEER);
+
imp->imp_dlm_handle = *dlm_handle;
imp->imp_level = LUSTRE_CONN_CON;
struct obd_uuid remote_uuid;
struct list_head *p;
char *str, *tmp;
- int rc, i, abort_recovery;
+ int rc, abort_recovery;
ENTRY;
LASSERT_REQSWAB (req, 0);
- str = lustre_msg_string (req->rq_reqmsg, 0, sizeof (tgtuuid.uuid) - 1);
+ str = lustre_msg_string(req->rq_reqmsg, 0, sizeof(tgtuuid) - 1);
if (str == NULL) {
CERROR("bad target UUID for connect\n");
GOTO(out, rc = -EINVAL);
}
+
obd_str2uuid (&tgtuuid, str);
+ target = class_uuid2obd(&tgtuuid);
+ if (!target || target->obd_stopping || !target->obd_set_up) {
+ CERROR("UUID '%s' is not available for connect\n", str);
+ GOTO(out, rc = -ENODEV);
+ }
LASSERT_REQSWAB (req, 1);
- str = lustre_msg_string (req->rq_reqmsg, 1, sizeof (cluuid.uuid) - 1);
+ str = lustre_msg_string(req->rq_reqmsg, 1, sizeof(cluuid) - 1);
if (str == NULL) {
CERROR("bad client UUID for connect\n");
GOTO(out, rc = -EINVAL);
}
- obd_str2uuid (&cluuid, str);
- i = class_uuid2dev(&tgtuuid);
- if (i == -1) {
- CERROR("UUID '%s' not found for connect\n", tgtuuid.uuid);
- GOTO(out, rc = -ENODEV);
- }
-
- target = &obd_dev[i];
- if (!target || target->obd_stopping || !target->obd_set_up) {
- CERROR("UUID '%s' is not available for connect\n", str);
- GOTO(out, rc = -ENODEV);
- }
+ obd_str2uuid (&cluuid, str);
/* XXX extract a nettype and format accordingly */
snprintf(remote_uuid.uuid, sizeof remote_uuid,
if (!recovering)
return;
- CDEBUG(D_ERROR, "timer will expire in %ld seconds\n",
- OBD_RECOVERY_TIMEOUT / HZ);
+ CERROR("timer will expire in %ld seconds\n", OBD_RECOVERY_TIMEOUT / HZ);
mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT);
}
if (recovery_done) {
struct list_head *tmp, *n;
ldlm_reprocess_all_ns(req->rq_export->exp_obd->obd_namespace);
- CDEBUG(D_ERROR,
- "%s: all clients recovered, sending delayed replies\n",
+ CERROR("%s: all clients recovered, sending delayed replies\n",
obd->obd_name);
obd->obd_recovering = 0;
list_for_each_safe(tmp, n, &obd->obd_delayed_reply_queue) {
-void mds_pack_req_body(struct ptlrpc_request *);
-void mds_pack_rep_body(struct ptlrpc_request *);
-void mds_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
+void mdc_pack_req_body(struct ptlrpc_request *);
+void mdc_pack_rep_body(struct ptlrpc_request *);
+void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
obd_id ino, int type);
-void mds_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
+void mdc_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
int flags, struct mdc_op_data *data);
-void mds_setattr_pack(struct ptlrpc_request *req,
+void mdc_setattr_pack(struct ptlrpc_request *req,
struct mdc_op_data *data,
- struct iattr *iattr, void *ea, int ealen);
-void mds_create_pack(struct ptlrpc_request *req, int offset,
+ struct iattr *iattr, void *ea, int ealen,
+ void *ea2, int ea2len);
+void mdc_create_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data,
__u32 mode, __u64 rdev, __u32 uid, __u32 gid, __u64 time,
const void *data, int datalen);
-void mds_open_pack(struct ptlrpc_request *req, int offset,
+void mdc_open_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data,
__u32 mode, __u64 rdev, __u32 uid, __u32 gid, __u64 time,
__u32 flags, const void *data, int datalen);
-void mds_unlink_pack(struct ptlrpc_request *req, int offset,
+void mdc_unlink_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data);
-void mds_link_pack(struct ptlrpc_request *req, int offset,
+void mdc_link_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data);
-void mds_rename_pack(struct ptlrpc_request *req, int offset,
+void mdc_rename_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen);
#include <linux/lustre_mds.h>
#include <linux/lustre_lite.h>
-void mds_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
+void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
obd_id ino, int type, __u64 xid)
{
struct mds_body *b;
b->nlink = size; /* !! */
}
-static void mds_pack_body(struct mds_body *b)
+static void mdc_pack_body(struct mds_body *b)
{
LASSERT (b != NULL);
b->capability = current->cap_effective;
}
-void mds_pack_req_body(struct ptlrpc_request *req)
+void mdc_pack_req_body(struct ptlrpc_request *req)
{
struct mds_body *b = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*b));
- mds_pack_body(b);
+ mdc_pack_body(b);
}
/* packing of MDS records */
-void mds_create_pack(struct ptlrpc_request *req, int offset,
+void mdc_create_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data,
__u32 mode, __u64 rdev, __u32 uid, __u32 gid, __u64 time,
const void *data, int datalen)
memcpy (tmp, data, datalen);
}
}
+
/* packing of MDS records */
-void mds_open_pack(struct ptlrpc_request *req, int offset,
+void mdc_open_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data,
__u32 mode, __u64 rdev, __u32 uid, __u32 gid, __u64 time,
__u32 flags, const void *data, int datalen)
rec->cr_fsuid = current->fsuid;
rec->cr_fsgid = current->fsgid;
rec->cr_cap = current->cap_effective;
- ll_ino2fid(&rec->cr_fid, op_data->ino1,
- op_data->gen1, op_data->typ1);
+ if (op_data != NULL)
+ ll_ino2fid(&rec->cr_fid, op_data->ino1,
+ op_data->gen1, op_data->typ1);
memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
rec->cr_mode = mode;
rec->cr_flags = flags;
else
rec->cr_suppgid = -1;
- tmp = lustre_msg_buf(req->rq_reqmsg, offset + 1, op_data->namelen + 1);
- LOGL0(op_data->name, op_data->namelen, tmp);
+ if (op_data->name) {
+ tmp = lustre_msg_buf(req->rq_reqmsg, offset + 1,
+ op_data->namelen + 1);
+ LOGL0(op_data->name, op_data->namelen, tmp);
+ }
if (data) {
tmp = lustre_msg_buf(req->rq_reqmsg, offset + 2, datalen);
memcpy (tmp, data, datalen);
}
}
-void mds_setattr_pack(struct ptlrpc_request *req,
+
+void mdc_setattr_pack(struct ptlrpc_request *req,
struct mdc_op_data *data,
- struct iattr *iattr, void *ea, int ealen)
+ struct iattr *iattr, void *ea, int ealen,
+ void *ea2, int ea2len)
{
struct mds_rec_setattr *rec = lustre_msg_buf(req->rq_reqmsg, 0,
sizeof (*rec));
rec->sa_suppgid = -1;
}
- if (ealen != 0)
- memcpy(lustre_msg_buf(req->rq_reqmsg, 1, ealen), ea, ealen);
+ if (ealen == 0)
+ return;
+
+ memcpy(lustre_msg_buf(req->rq_reqmsg, 1, ealen), ea, ealen);
+
+ if (ea2len == 0)
+ return;
+
+ memcpy(lustre_msg_buf(req->rq_reqmsg, 2, ea2len), ea2, ea2len);
}
-void mds_unlink_pack(struct ptlrpc_request *req, int offset,
+void mdc_unlink_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data)
{
struct mds_rec_unlink *rec;
LOGL0(data->name, data->namelen, tmp);
}
-void mds_link_pack(struct ptlrpc_request *req, int offset,
+void mdc_link_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data)
{
struct mds_rec_link *rec;
LOGL0(data->name, data->namelen, tmp);
}
-void mds_rename_pack(struct ptlrpc_request *req, int offset,
+void mdc_rename_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen)
{
}
}
-void mds_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
+void mdc_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
int flags, struct mdc_op_data *data)
{
struct mds_body *b;
+#ifndef _MDS_INTERNAL_H
+#define _MDS_INTERNAL_H
+static inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
+{
+ return &req->rq_export->exp_obd->u.mds;
+}
+
+/* mds/mds_fs.c */
+struct llog_handle *mds_log_create(struct obd_device *obd);
+int mds_log_close(struct llog_handle *cathandle, struct llog_handle *loghandle);
+struct llog_handle *mds_log_open(struct obd_device *obd,
+ struct llog_cookie *logcookie);
+struct llog_handle *mds_get_catalog(struct obd_device *obd);
+void mds_put_catalog(struct llog_handle *cathandle);
+
+/* mds/handler.c */
struct mds_file_data *mds_mfd_new(void);
void mds_mfd_put(struct mds_file_data *mfd);
void mds_mfd_destroy(struct mds_file_data *mfd);
+
+/* mds/mds_reint.c */
+void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error);
+int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle,
+ struct ptlrpc_request *req, int rc, __u32 op_data);
+
+/* mds/mds_lib.c */
int mds_update_unpack(struct ptlrpc_request *, int offset,
struct mds_update_record *);
+/* mds/mds_lov.c */
+int mds_get_lovtgts(struct mds_obd *mds, int tgt_count,
+ struct obd_uuid *uuidarray);
+
+/* mds/mds_open.c */
+int mds_open(struct mds_update_record *rec, int offset,
+ struct ptlrpc_request *req, struct lustre_handle *);
+int mds_pin(struct ptlrpc_request *req);
+
/* mds/mds_fs.c */
int mds_client_add(struct obd_device *obd, struct mds_obd *mds,
struct mds_export_data *med, int cl_off);
void mds_pack_inode2fid(struct ll_fid *fid, struct inode *inode);
void mds_pack_inode2body(struct mds_body *body, struct inode *inode);
#endif
+
+#endif /* _MDS_INTERNAL_H */
b->gid = inode->i_gid;
b->flags = inode->i_flags;
b->rdev = b->rdev;
- b->nlink = inode->i_nlink;
+ /* Return the correct link count for orphan inodes */
+ b->nlink = mds_inode_is_orphan(inode) ? 0 : inode->i_nlink;
b->generation = inode->i_generation;
b->suppgid = -1;
}
+
/* unpacking */
static int mds_setattr_unpack(struct ptlrpc_request *req, int offset,
struct mds_update_record *r)
struct mds_rec_setattr *rec;
ENTRY;
- rec = lustre_swab_reqbuf (req, offset, sizeof (*rec),
- lustre_swab_mds_rec_setattr);
+ rec = lustre_swab_reqbuf(req, offset, sizeof(*rec),
+ lustre_swab_mds_rec_setattr);
if (rec == NULL)
RETURN (-EFAULT);
if (r->ur_eadata == NULL)
RETURN (-EFAULT);
r->ur_eadatalen = req->rq_reqmsg->buflens[offset + 1];
- } else {
- r->ur_eadata = NULL;
- r->ur_eadatalen = 0;
+ }
+
+ if (req->rq_reqmsg->bufcount > offset + 2) {
+ r->ur_logcookies = lustre_msg_buf(req->rq_reqmsg, offset + 2,0);
+ if (r->ur_eadata == NULL)
+ RETURN (-EFAULT);
+
+ r->ur_cookielen = req->rq_reqmsg->buflens[offset + 2];
}
RETURN(0);
if (r->ur_tgt == NULL)
RETURN (-EFAULT);
r->ur_tgtlen = req->rq_reqmsg->buflens[offset + 2];
- } else {
- r->ur_tgt = NULL;
- r->ur_tgtlen = 0;
}
RETURN(0);
}
current->fsgid = saved->ouc.ouc_fsgid;
current->cap_effective = saved->ouc.ouc_cap;
current->ngroups = saved->ngroups;
-
current->groups[0] = saved->ouc.ouc_suppgid1;
current->groups[1] = saved->ouc.ouc_suppgid2;
}
portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
- CDEBUG_STACK(), format , ## a); \
+ CDEBUG_STACK(), format, ## a); \
} while (0)
#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sighand->siglock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sighand->siglock, flags)
# define RECALC_SIGPENDING recalc_sigpending()
#else
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sigmask_lock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sigmask_lock, flags)
# define RECALC_SIGPENDING recalc_sigpending(current)
#endif
+
+#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+#else
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt, ## a)
+#endif
#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
/*
* Simple doubly linked list implementation.
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
+#endif
+#ifndef list_for_each_entry
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
+#endif
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
/*
-*/
-/*
* stringtab.h
*/
int ptlrpc_pinger_add_import(struct obd_import *imp)
{
+#ifndef ENABLE_PINGER
+ return 0;
+#else
int rc;
ENTRY;
-#ifndef ENABLE_PINGER
- RETURN(0);
-#else
if (!list_empty(&imp->imp_pinger_chain))
RETURN(-EALREADY);
int ptlrpc_pinger_del_import(struct obd_import *imp)
{
+#ifndef ENABLE_PINGER
+ return 0;
+#else
int rc;
ENTRY;
-#ifndef ENABLE_PINGER
- RETURN(0);
-#else
if (list_empty(&imp->imp_pinger_chain))
RETURN(-ENOENT);
RECALC_SIGPENDING;
SIGNAL_MASK_UNLOCK(current, flags);
-#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
- sprintf(current->comm, "%s|%d", data->name,current->thread.extern_pid);
-#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- sprintf(current->comm, "%s|%d", data->name,
- current->thread.mode.tt.extern_pid);
-#else
- strcpy(current->comm, data->name);
-#endif
+ THREAD_NAME(current->comm, "%s", data->name);
unlock_kernel();
/* Record that the thread is running */
cli->cl_import = imp;
cli->cl_max_mds_easize = sizeof(struct lov_mds_md);
+ cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie);
cli->cl_sandev = to_kdev_t(0);
RETURN(0);
}
-int client_obd_cleanup(struct obd_device *obddev, int force, int failover)
+int client_obd_cleanup(struct obd_device *obddev, int flags)
{
struct client_obd *client = &obddev->u.cli;