From 68d35769b745b29b1a58e75831d53ecbc36d8f59 Mon Sep 17 00:00:00 2001 From: ericm Date: Tue, 25 Nov 2003 11:34:29 +0000 Subject: [PATCH] merge b_devel to b_eq: 20031125. kernel part only. --- .../patches/dev_read_only_2.4.20-rh.patch | 28 ++++++---- lustre/kernel_patches/series/vanilla-2.4.20 | 2 +- lustre/ldlm/ldlm_lib.c | 65 ++++++++++++---------- lustre/mdc/mdc_lib.c | 17 +++++- lustre/utils/wirecheck.c | 44 ++++++++++++++- 5 files changed, 110 insertions(+), 46 deletions(-) diff --git a/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch b/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch index 1b589b9..a02c57f 100644 --- a/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch +++ b/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch @@ -3,9 +3,11 @@ drivers/ide/ide-disk.c | 5 +++++ 3 files changed, 43 insertions(+) ---- kernel-2.4.20-6chaos_18_7/drivers/block/blkpg.c~dev_read_only_2.4.20-rh 2003-05-15 21:12:48.000000000 -0600 -+++ kernel-2.4.20-6chaos_18_7-braam/drivers/block/blkpg.c 2003-07-12 15:10:31.000000000 -0600 -@@ -297,3 +297,38 @@ int blk_ioctl(kdev_t dev, unsigned int c +Index: linux-2.4.20-rh-20.9/drivers/block/blkpg.c +=================================================================== +--- linux-2.4.20-rh-20.9.orig/drivers/block/blkpg.c 2003-11-13 17:19:32.000000000 +0300 ++++ linux-2.4.20-rh-20.9/drivers/block/blkpg.c 2003-11-13 17:20:28.000000000 +0300 +@@ -297,3 +297,38 @@ } EXPORT_SYMBOL(blk_ioctl); @@ -44,9 +46,11 @@ +EXPORT_SYMBOL(dev_set_rdonly); +EXPORT_SYMBOL(dev_check_rdonly); +EXPORT_SYMBOL(dev_clear_rdonly); ---- kernel-2.4.20-6chaos_18_7/drivers/block/loop.c~dev_read_only_2.4.20-rh 2003-05-15 21:12:50.000000000 -0600 -+++ kernel-2.4.20-6chaos_18_7-braam/drivers/block/loop.c 2003-07-12 15:10:31.000000000 -0600 -@@ -491,6 +491,9 @@ static int loop_make_request(request_que +Index: linux-2.4.20-rh-20.9/drivers/block/loop.c +=================================================================== +--- linux-2.4.20-rh-20.9.orig/drivers/block/loop.c 2003-11-13 17:19:32.000000000 +0300 ++++ linux-2.4.20-rh-20.9/drivers/block/loop.c 2003-11-13 17:20:28.000000000 +0300 +@@ -491,6 +491,9 @@ spin_unlock_irq(&lo->lo_lock); if (rw == WRITE) { @@ -56,19 +60,19 @@ if (lo->lo_flags & LO_FLAGS_READ_ONLY) goto err; } else if (rw == READA) { ---- kernel-2.4.20-6chaos_18_7/drivers/ide/ide-disk.c~dev_read_only_2.4.20-rh 2003-05-15 21:13:09.000000000 -0600 -+++ kernel-2.4.20-6chaos_18_7-braam/drivers/ide/ide-disk.c 2003-07-12 15:12:03.000000000 -0600 -@@ -371,6 +371,11 @@ ide_startstop_t __ide_do_rw_disk (ide_dr +Index: linux-2.4.20-rh-20.9/drivers/ide/ide-disk.c +=================================================================== +--- linux-2.4.20-rh-20.9.orig/drivers/ide/ide-disk.c 2003-11-13 17:19:32.000000000 +0300 ++++ linux-2.4.20-rh-20.9/drivers/ide/ide-disk.c 2003-11-13 18:13:46.000000000 +0300 +@@ -371,6 +371,11 @@ if (driver_blocked) panic("Request while ide driver is blocked?"); + if (rq->cmd == WRITE && dev_check_rdonly(rq->rq_dev)) { -+ ide_end_request(1, HWGROUP(drive)); ++ ide_end_request(drive, 1); + return ide_stopped; + } + if (IDE_CONTROL_REG) hwif->OUTB(drive->ctl, IDE_CONTROL_REG); - -_ diff --git a/lustre/kernel_patches/series/vanilla-2.4.20 b/lustre/kernel_patches/series/vanilla-2.4.20 index 2a8f20a..46f5fd8 100644 --- a/lustre/kernel_patches/series/vanilla-2.4.20 +++ b/lustre/kernel_patches/series/vanilla-2.4.20 @@ -3,7 +3,6 @@ uml-2.4.20-do_mmap_pgoff-fix.patch uml-2.4.20-fixes-1.patch dev_read_only_2.4.20.patch exports_2.4.20.patch -kmem_cache_validate_2.4.20.patch lustre_version.patch vfs_intent-2.4.20-vanilla.patch invalidate_show.patch @@ -46,3 +45,4 @@ ext3-ea-in-inode-2.4.20.patch listman-2.4.20.patch ext3-trusted_ea-2.4.20.patch kernel_text_address-2.4.20-vanilla.patch +ext3-xattr-ptr-arith-fix.patch diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 1cedbf9..a50232d 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -30,10 +30,10 @@ # include #endif #include -#include +#include /* for LUSTRE_OSC_NAME */ +#include /* for LUSTRE_MDC_NAME */ #include #include -#include #include int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) @@ -105,9 +105,11 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) INIT_LIST_HEAD(&cli->cl_loi_ready_list); spin_lock_init(&cli->cl_loi_list_lock); cli->cl_brw_in_flight = 0; - spin_lock_init(&cli->cl_rpc_concurrency_oh.oh_lock); - spin_lock_init(&cli->cl_pages_per_rpc_oh.oh_lock); - cli->cl_max_pages_per_rpc = PTL_MD_MAX_IOV; + spin_lock_init(&cli->cl_read_rpc_hist.oh_lock); + spin_lock_init(&cli->cl_write_rpc_hist.oh_lock); + spin_lock_init(&cli->cl_read_page_hist.oh_lock); + spin_lock_init(&cli->cl_write_page_hist.oh_lock); + cli->cl_max_pages_per_rpc = PTL_MD_MAX_PAGES; cli->cl_max_rpcs_in_flight = 8; ldlm_get_ref(); @@ -134,7 +136,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) imp->imp_connect_op = connect_op; imp->imp_generation = 0; INIT_LIST_HEAD(&imp->imp_pinger_chain); - memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, + memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, lcfg->lcfg_inllen1); class_import_put(imp); @@ -143,45 +145,45 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); cli->cl_sandev = to_kdev_t(0); - if (lcfg->lcfg_inllen3 != 0) { + if (lcfg->lcfg_inllen3 != 0) { if (!strcmp(lcfg->lcfg_inlbuf3, "inactive")) { CDEBUG(D_HA, "marking %s %s->%s as inactive\n", - name, obddev->obd_name, + name, obddev->obd_name, imp->imp_target_uuid.uuid); imp->imp_invalid = 1; - + if (lcfg->lcfg_inllen4 != 0) mgmt_name = lcfg->lcfg_inlbuf4; } else { mgmt_name = lcfg->lcfg_inlbuf3; } } - + if (mgmt_name != NULL) { /* Register with management client if we need to. */ CDEBUG(D_HA, "%s registering with %s for events about %s\n", obddev->obd_name, mgmt_name, server_uuid.uuid); - + mgmt_obd = class_name2obd(mgmt_name); if (!mgmt_obd) { CERROR("can't find mgmtcli %s to register\n", mgmt_name); GOTO(err_import, rc = -ENOSYS); } - + register_f = inter_module_get("mgmtcli_register_for_events"); if (!register_f) { CERROR("can't i_m_g mgmtcli_register_for_events\n"); GOTO(err_import, rc = -ENOSYS); } - + rc = register_f(mgmt_obd, obddev, &imp->imp_target_uuid); inter_module_put("mgmtcli_register_for_events"); - + if (!rc) cli->cl_mgmtcli_obd = mgmt_obd; } - + RETURN(rc); err_import: @@ -201,7 +203,7 @@ int client_obd_cleanup(struct obd_device *obddev, int flags) RETURN(-EINVAL); if (cli->cl_mgmtcli_obd) { mgmtcli_deregister_for_events_t dereg_f; - + dereg_f = inter_module_get("mgmtcli_deregister_for_events"); dereg_f(cli->cl_mgmtcli_obd, obddev); inter_module_put("mgmtcli_deregister_for_events"); @@ -243,7 +245,7 @@ int client_connect_import(struct lustre_handle *dlm_handle, imp->imp_dlm_handle = *dlm_handle; imp->imp_state = LUSTRE_IMP_DISCON; - + rc = ptlrpc_connect_import(imp); if (rc != 0) { LASSERT (imp->imp_state == LUSTRE_IMP_DISCON); @@ -289,9 +291,8 @@ int client_disconnect_export(struct obd_export *exp, int failover) ENTRY; if (!obd) { - CERROR("invalid export for disconnect: " - "exp %p cookie "LPX64"\n", exp, - exp ? exp->exp_handle.h_cookie : -1UL); + CERROR("invalid export for disconnect: exp %p cookie "LPX64"\n", + exp, exp ? exp->exp_handle.h_cookie : -1); RETURN(-EINVAL); } @@ -306,8 +307,10 @@ int client_disconnect_export(struct obd_export *exp, int failover) if (cli->cl_conn_count) GOTO(out_no_disconnect, rc = 0); - if (imp->imp_replayable) - ptlrpc_pinger_del_import(imp); + /* Some non-replayable imports (MDS's OSCs) are pinged, so just + * delete it regardless. (It's safe to delete an import that was + * never added.) */ + (void)ptlrpc_pinger_del_import(imp); if (obd->obd_namespace != NULL) { /* obd_no_recov == local only */ @@ -356,12 +359,7 @@ int target_handle_reconnect(struct lustre_handle *conn, struct obd_export *exp, LPX64")\n", cluuid->uuid, exp->exp_connection->c_remote_uuid.uuid, hdl->cookie, conn->cookie); - /* XXX disconnect them here? */ memset(conn, 0, sizeof *conn); - /* This is a little scary, but right now we build this - * file separately into each server module, so I won't - * go _immediately_ to hell. - */ RETURN(-EALREADY); } } @@ -435,7 +433,7 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) GOTO(out, rc); /* lctl gets a backstage, all-access pass. */ - if (obd_uuid_equals(&cluuid, &lctl_fake_uuid)) + if (obd_uuid_equals(&cluuid, &target->obd_uuid)) goto dont_check_exports; spin_lock(&target->obd_dev_lock); @@ -451,8 +449,13 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) export = NULL; } /* If we found an export, we already unlocked. */ - if (!export) + if (!export) { spin_unlock(&target->obd_dev_lock); + } else if (req->rq_reqmsg->conn_cnt == 1) { + CERROR("%s reconnected with 1 conn_cnt; cookies not random?\n", + cluuid.uuid); + GOTO(out, rc = -EALREADY); + } /* Tell the client if we're in recovery. */ /* If this is the first client, start the recovery timer */ @@ -468,7 +471,9 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) if (export == NULL) { if (target->obd_recovering) { CERROR("denying connection for new client %s: " - "in recovery\n", cluuid.uuid); + "%d clients in recovery for %lds\n", cluuid.uuid, + target->obd_recoverable_clients, + (target->obd_recovery_timer.expires-jiffies)/HZ); rc = -EBUSY; } else { dont_check_exports: diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index d573eea7..e3a1c4d 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "mdc_internal.h" void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size, @@ -88,6 +87,20 @@ void mdc_create_pack(struct ptlrpc_request *req, int offset, } } +static __u32 mds_pack_open_flags(__u32 flags) +{ + return + (flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC | + MDS_OPEN_DELAY_CREATE | MDS_OPEN_HAS_EA)) | + ((flags & O_CREAT) ? MDS_OPEN_CREAT : 0) | + ((flags & O_EXCL) ? MDS_OPEN_EXCL : 0) | + ((flags & O_TRUNC) ? MDS_OPEN_TRUNC : 0) | + ((flags & O_APPEND) ? MDS_OPEN_APPEND : 0) | + ((flags & O_SYNC) ? MDS_OPEN_SYNC : 0) | + ((flags & O_DIRECTORY) ? MDS_OPEN_DIRECTORY : 0) | + 0; +} + /* packing of MDS records */ void mdc_open_pack(struct ptlrpc_request *req, int offset, struct mdc_op_data *op_data, __u32 mode, __u64 rdev, @@ -106,7 +119,7 @@ void mdc_open_pack(struct ptlrpc_request *req, int offset, rec->cr_fid = op_data->fid1; memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid)); rec->cr_mode = mode; - rec->cr_flags = flags; + rec->cr_flags = mds_pack_open_flags(flags); rec->cr_rdev = rdev; rec->cr_time = op_data->mod_time; rec->cr_suppgid = op_data->ctxt.gid1; diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 2e5d51e..7397fcb 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -245,6 +245,7 @@ check_mds_body(void) CHECK_MEMBER(mds_body, handle); CHECK_MEMBER(mds_body, size); CHECK_MEMBER(mds_body, blocks); + CHECK_MEMBER(mds_body, io_epoch); CHECK_MEMBER(mds_body, ino); CHECK_MEMBER(mds_body, valid); CHECK_MEMBER(mds_body, fsuid); @@ -262,6 +263,17 @@ check_mds_body(void) CHECK_MEMBER(mds_body, generation); CHECK_MEMBER(mds_body, suppgid); CHECK_MEMBER(mds_body, eadatasize); + + CHECK_VALUE(FMODE_READ); + CHECK_VALUE(FMODE_WRITE); + CHECK_VALUE(FMODE_EXEC); + CHECK_VALUE(MDS_OPEN_CREAT); + CHECK_VALUE(MDS_OPEN_EXCL); + CHECK_VALUE(MDS_OPEN_APPEND); + CHECK_VALUE(MDS_OPEN_SYNC); + CHECK_VALUE(MDS_OPEN_DIRECTORY); + CHECK_VALUE(MDS_OPEN_DELAY_CREATE); + CHECK_VALUE(MDS_OPEN_HAS_EA); } void @@ -490,6 +502,14 @@ check_llog_logid(void) CHECK_MEMBER(llog_logid, lgl_oid); CHECK_MEMBER(llog_logid, lgl_ogr); CHECK_MEMBER(llog_logid, lgl_ogen); + + CHECK_VALUE(OST_SZ_REC); + CHECK_VALUE(OST_RAID1_REC); + CHECK_VALUE(MDS_UNLINK_REC); + CHECK_VALUE(OBD_CFG_REC); + CHECK_VALUE(PTL_CFG_REC); + CHECK_VALUE(LLOG_HDR_MAGIC); + CHECK_VALUE(LLOG_LOGID_MAGIC); } void @@ -545,9 +565,11 @@ check_llogd_body(void) BLANK_LINE(); CHECK_STRUCT(llogd_body); CHECK_MEMBER(llogd_body, lgd_logid); - CHECK_MEMBER(llogd_body, lgd_len); + CHECK_MEMBER(llogd_body, lgd_ctxt_idx); + CHECK_MEMBER(llogd_body, lgd_llh_flags); CHECK_MEMBER(llogd_body, lgd_index); CHECK_MEMBER(llogd_body, lgd_saved_index); + CHECK_MEMBER(llogd_body, lgd_len); CHECK_MEMBER(llogd_body, lgd_cur_offset); CHECK_VALUE(LLOG_ORIGIN_HANDLE_CREATE); @@ -557,6 +579,25 @@ check_llogd_body(void) CHECK_VALUE(LLOG_ORIGIN_HANDLE_CLOSE); } +void +check_llog_ctxt_gen(void) +{ + BLANK_LINE(); + CHECK_STRUCT(llog_ctxt_gen); + CHECK_MEMBER(llog_ctxt_gen, mnt_cnt); + CHECK_MEMBER(llog_ctxt_gen, conn_cnt); +} + +void +check_llogd_conn_body(void) +{ + BLANK_LINE(); + CHECK_STRUCT(llogd_conn_body); + CHECK_MEMBER(llogd_conn_body, lgdc_gen); + CHECK_MEMBER(llogd_conn_body, lgdc_logid); + CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx); +} + int main(int argc, char **argv) { @@ -695,6 +736,7 @@ main(int argc, char **argv) check_llog_log_hdr(); check_llog_cookie(); check_llogd_body(); + check_llogd_conn_body(); printf("}\n\n"); -- 1.8.3.1