From 86d621168d707664c73b67e1c87139aba3784875 Mon Sep 17 00:00:00 2001 From: pschwan Date: Sat, 5 Jul 2003 22:47:31 +0000 Subject: [PATCH] land b_merge on b_devel. Includes b_mount and b_orphan, which includes: - orphans are moved into the PENDING directory for possible recovery - replayed opens now open by fid for orphan/rename safety (1042) - last close of an orphan inode generates a transno (683) - avoid CERROR in normal ll_setattr_raw() error case (1500) Added code which is currently disabled: - dentry pinning from b_mount for cwd and mountpoints (1020) - logging code for orphans (and many other things) --- lnet/include/linux/kp30.h | 2 +- lnet/include/linux/portals_compat25.h | 19 ++++++++-- lnet/include/lnet/internal.h | 2 - lnet/include/lnet/list.h | 7 +++- lnet/include/lnet/myrnal.h | 3 -- lnet/include/lnet/nal.h | 2 - lnet/include/lnet/ppid.h | 3 -- lnet/include/lnet/stringtab.h | 2 - lustre/ldlm/ldlm_lib.c | 35 ++++++++--------- lustre/mdc/mdc_internal.h | 23 ++++++------ lustre/mdc/mdc_lib.c | 50 ++++++++++++++++--------- lustre/mds/mds_internal.h | 34 +++++++++++++++++ lustre/mds/mds_lib.c | 22 ++++++----- lustre/obdclass/simple.c | 1 - lustre/portals/include/linux/kp30.h | 2 +- lustre/portals/include/linux/portals_compat25.h | 19 ++++++++-- lustre/portals/include/portals/list.h | 7 +++- lustre/portals/include/portals/myrnal.h | 3 -- lustre/portals/include/portals/nal.h | 2 - lustre/portals/include/portals/ppid.h | 3 -- lustre/portals/include/portals/stringtab.h | 2 - lustre/ptlrpc/pinger.c | 21 ++++------- lustre/ptlrpc/ptlrpc_lib.c | 3 +- 23 files changed, 157 insertions(+), 110 deletions(-) diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index ee3b9fc..f607359 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -118,7 +118,7 @@ do { \ 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) diff --git a/lnet/include/linux/portals_compat25.h b/lnet/include/linux/portals_compat25.h index e28fbac..c5e17a9 100644 --- a/lnet/include/linux/portals_compat25.h +++ b/lnet/include/linux/portals_compat25.h @@ -1,13 +1,24 @@ #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 diff --git a/lnet/include/lnet/internal.h b/lnet/include/lnet/internal.h index d78cad4..a70b465 100644 --- a/lnet/include/lnet/internal.h +++ b/lnet/include/lnet/internal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _P30_INTERNAL_H_ #define _P30_INTERNAL_H_ diff --git a/lnet/include/lnet/list.h b/lnet/include/lnet/list.h index 2b63312..78a1e2d 100644 --- a/lnet/include/lnet/list.h +++ b/lnet/include/lnet/list.h @@ -1,6 +1,4 @@ #ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - /* * Simple doubly linked list implementation. @@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry) __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 @@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list, __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. diff --git a/lnet/include/lnet/myrnal.h b/lnet/include/lnet/myrnal.h index 12b1925..13790f7 100644 --- a/lnet/include/lnet/myrnal.h +++ b/lnet/include/lnet/myrnal.h @@ -1,6 +1,3 @@ -/* -*/ - #ifndef MYRNAL_H #define MYRNAL_H diff --git a/lnet/include/lnet/nal.h b/lnet/include/lnet/nal.h index 88be63c..7cb3ab7 100644 --- a/lnet/include/lnet/nal.h +++ b/lnet/include/lnet/nal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _NAL_H_ #define _NAL_H_ diff --git a/lnet/include/lnet/ppid.h b/lnet/include/lnet/ppid.h index 4727599..760f465 100644 --- a/lnet/include/lnet/ppid.h +++ b/lnet/include/lnet/ppid.h @@ -1,6 +1,3 @@ -/* - */ - #ifndef _INCppidh_ #define _INCppidh_ diff --git a/lnet/include/lnet/stringtab.h b/lnet/include/lnet/stringtab.h index c9683f7..33e4375 100644 --- a/lnet/include/lnet/stringtab.h +++ b/lnet/include/lnet/stringtab.h @@ -1,5 +1,3 @@ /* -*/ -/* * stringtab.h */ diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 9b53b54..6c7c8d1 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -32,7 +32,7 @@ #include #include -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) { @@ -74,6 +74,8 @@ int client_import_connect(struct lustre_handle *dlm_handle, 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; @@ -229,36 +231,31 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) 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, @@ -491,8 +488,7 @@ static void reset_recovery_timer(struct obd_device *obd) 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); } @@ -715,8 +711,7 @@ int target_queue_final_reply(struct ptlrpc_request *req, int rc) 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) { diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index e39a0aa..49d85ab2 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -1,24 +1,25 @@ -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); diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 806a830..a17f7a1 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -28,7 +28,7 @@ #include #include -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; @@ -45,7 +45,7 @@ void mds_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size, b->nlink = size; /* !! */ } -static void mds_pack_body(struct mds_body *b) +static void mdc_pack_body(struct mds_body *b) { LASSERT (b != NULL); @@ -54,14 +54,14 @@ static void mds_pack_body(struct mds_body *b) 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) @@ -94,8 +94,9 @@ void mds_create_pack(struct ptlrpc_request *req, int offset, 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) @@ -109,8 +110,9 @@ void mds_open_pack(struct ptlrpc_request *req, int offset, 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; @@ -123,17 +125,22 @@ void mds_open_pack(struct ptlrpc_request *req, int offset, 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)); @@ -163,11 +170,18 @@ void mds_setattr_pack(struct ptlrpc_request *req, 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; @@ -194,7 +208,7 @@ void mds_unlink_pack(struct ptlrpc_request *req, int offset, 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; @@ -221,7 +235,7 @@ void mds_link_pack(struct ptlrpc_request *req, int offset, 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) { @@ -255,7 +269,7 @@ void mds_rename_pack(struct ptlrpc_request *req, int offset, } } -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; diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 0b62a92..c2d3d77 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -1,9 +1,41 @@ +#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); @@ -13,3 +45,5 @@ int mds_client_free(struct obd_export *exp); 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 */ diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c index 8f16795..a72e176 100644 --- a/lustre/mds/mds_lib.c +++ b/lustre/mds/mds_lib.c @@ -80,10 +80,12 @@ void mds_pack_inode2body(struct mds_body *b, struct inode *inode) 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) @@ -92,8 +94,8 @@ static int mds_setattr_unpack(struct ptlrpc_request *req, int offset, 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); @@ -120,9 +122,14 @@ static int mds_setattr_unpack(struct ptlrpc_request *req, int offset, 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); @@ -172,9 +179,6 @@ static int mds_create_unpack(struct ptlrpc_request *req, int offset, 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); } diff --git a/lustre/obdclass/simple.c b/lustre/obdclass/simple.c index 0ce54a3..4a4ae4c 100644 --- a/lustre/obdclass/simple.c +++ b/lustre/obdclass/simple.c @@ -139,7 +139,6 @@ void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx, 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; } diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index ee3b9fc..f607359 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -118,7 +118,7 @@ do { \ 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) diff --git a/lustre/portals/include/linux/portals_compat25.h b/lustre/portals/include/linux/portals_compat25.h index e28fbac..c5e17a9 100644 --- a/lustre/portals/include/linux/portals_compat25.h +++ b/lustre/portals/include/linux/portals_compat25.h @@ -1,13 +1,24 @@ #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 diff --git a/lustre/portals/include/portals/list.h b/lustre/portals/include/portals/list.h index 2b63312..78a1e2d 100644 --- a/lustre/portals/include/portals/list.h +++ b/lustre/portals/include/portals/list.h @@ -1,6 +1,4 @@ #ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - /* * Simple doubly linked list implementation. @@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry) __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 @@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list, __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. diff --git a/lustre/portals/include/portals/myrnal.h b/lustre/portals/include/portals/myrnal.h index 12b1925..13790f7 100644 --- a/lustre/portals/include/portals/myrnal.h +++ b/lustre/portals/include/portals/myrnal.h @@ -1,6 +1,3 @@ -/* -*/ - #ifndef MYRNAL_H #define MYRNAL_H diff --git a/lustre/portals/include/portals/nal.h b/lustre/portals/include/portals/nal.h index 88be63c..7cb3ab7 100644 --- a/lustre/portals/include/portals/nal.h +++ b/lustre/portals/include/portals/nal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _NAL_H_ #define _NAL_H_ diff --git a/lustre/portals/include/portals/ppid.h b/lustre/portals/include/portals/ppid.h index 4727599..760f465 100644 --- a/lustre/portals/include/portals/ppid.h +++ b/lustre/portals/include/portals/ppid.h @@ -1,6 +1,3 @@ -/* - */ - #ifndef _INCppidh_ #define _INCppidh_ diff --git a/lustre/portals/include/portals/stringtab.h b/lustre/portals/include/portals/stringtab.h index c9683f7..33e4375 100644 --- a/lustre/portals/include/portals/stringtab.h +++ b/lustre/portals/include/portals/stringtab.h @@ -1,5 +1,3 @@ /* -*/ -/* * stringtab.h */ diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index ebc69e1..cca7065 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -47,12 +47,12 @@ void ptlrpc_pinger_sending_on_import(struct obd_import *imp) 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); @@ -77,12 +77,12 @@ int ptlrpc_pinger_add_import(struct obd_import *imp) 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); @@ -118,14 +118,7 @@ static int ptlrpc_pinger_main(void *arg) 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 */ diff --git a/lustre/ptlrpc/ptlrpc_lib.c b/lustre/ptlrpc/ptlrpc_lib.c index ccc05dc..ddb2a8a 100644 --- a/lustre/ptlrpc/ptlrpc_lib.c +++ b/lustre/ptlrpc/ptlrpc_lib.c @@ -108,12 +108,13 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) 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; -- 1.8.3.1