From: nikita Date: Wed, 19 Jul 2006 13:10:38 +0000 (+0000) Subject: pass lu_context to ->o_connect() method X-Git-Tag: v1_8_0_110~486^2~1385 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a232fc2e666bb3273e5a387839920eaa1075265d;p=fs%2Flustre-release.git pass lu_context to ->o_connect() method --- diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index 74f944f..7434cf5 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -51,7 +51,8 @@ static struct md_device_operations mdc_md_ops = { 0 }; * mdc_add_obd() find that obd by uuid and connects to it. * Local MDT uuid is used for connection * */ -static int mdc_add_obd(struct mdc_device *mc, struct lustre_cfg *cfg) +static int mdc_add_obd(const struct lu_context *ctx, + struct mdc_device *mc, struct lustre_cfg *cfg) { struct mdc_cli_desc *desc = &mc->mc_desc; struct obd_device *mdc, *mdt; @@ -93,7 +94,7 @@ static int mdc_add_obd(struct mdc_device *mc, struct lustre_cfg *cfg) CDEBUG(D_CONFIG, "connect to %s(%s)\n", mdc->obd_name, mdc->obd_uuid.uuid); - rc = obd_connect(conn, mdc, &mdt->obd_uuid, NULL); + rc = obd_connect(ctx, conn, mdc, &mdt->obd_uuid, NULL); if (rc) { CERROR("target %s connect error %d\n", @@ -135,7 +136,7 @@ static int mdc_process_config(const struct lu_context *ctx, ENTRY; switch (cfg->lcfg_command) { case LCFG_ADD_MDC: - rc = mdc_add_obd(mc, cfg); + rc = mdc_add_obd(ctx, mc, cfg); break; default: rc = -EOPNOTSUPP; diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 48231f0..5d47d3e 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -818,7 +818,8 @@ ptlrpc_rs_decref(struct ptlrpc_reply_state *rs) /* ldlm/ldlm_lib.c */ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg); int client_obd_cleanup(struct obd_device *obddev); -int client_connect_import(struct lustre_handle *conn, struct obd_device *obd, +int client_connect_import(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *); int client_disconnect_export(struct obd_export *exp); int client_import_add_conn(struct obd_import *imp, struct obd_uuid *uuid, diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 71a5c72..8533e0c 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -406,7 +406,7 @@ struct mgs_obd { struct md_lov_info; struct md_lov_ops { - int (*ml_read_objids)(struct obd_device *obd, struct md_lov_info *mli, + int (*ml_read_objids)(struct obd_device *obd, struct md_lov_info *mli, const void *ctxt); int (*ml_write_objids)(struct obd_device *obd, struct md_lov_info *mli, const void *ctxt); @@ -548,7 +548,7 @@ struct lmv_obd { int max_cookiesize; int server_timeout; struct semaphore init_sem; - + struct lmv_tgt_desc *tgts; int tgts_size; @@ -572,7 +572,7 @@ struct niobuf_local { #define LUSTRE_OPC_SYMLINK (1 << 1) #define LUSTRE_OPC_MKNOD (1 << 2) #define LUSTRE_OPC_CREATE (1 << 3) - + struct lu_placement_hint { struct qstr *ph_pname; struct qstr *ph_cname; @@ -752,7 +752,7 @@ struct obd_device { struct fsfilt_operations *obd_fsops; spinlock_t obd_osfs_lock; struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */ - cfs_time_t obd_osfs_age; + cfs_time_t obd_osfs_age; struct lvfs_run_ctxt obd_lvfs_ctxt; struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS]; struct obd_device *obd_observer; @@ -799,7 +799,7 @@ struct obd_device { unsigned int md_cntr_base; struct lprocfs_stats *md_stats; - + cfs_proc_dir_entry_t *obd_svc_procroot; struct lprocfs_stats *obd_svc_stats; }; @@ -830,6 +830,8 @@ enum obd_cleanup_stage { #define KEY_INIT_RECOV "initial_recov" #define KEY_INIT_RECOV_BACKUP "init_recov_bk" +struct lu_context; + struct obd_ops { struct module *o_owner; int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, @@ -855,7 +857,8 @@ struct obd_ops { * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags * asked for. If @ocd == NULL, use default parameters. */ - int (*o_connect)(struct lustre_handle *conn, struct obd_device *src, + int (*o_connect)(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *ocd); int (*o_reconnect)(struct obd_export *exp, struct obd_device *src, struct obd_uuid *cluuid, @@ -868,9 +871,9 @@ struct obd_ops { int (*o_fid_alloc)(struct obd_export *exp, struct lu_fid *fid, struct lu_placement_hint *hint); - + int (*o_fid_delete)(struct obd_export *exp, struct lu_fid *fid); - + int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs, unsigned long max_age); int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, @@ -1059,23 +1062,23 @@ struct md_ops { int, int, int, struct ptlrpc_request **); int (*m_init_ea_size)(struct obd_export *, int, int, int); - + int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *, int, struct obd_export *, struct lustre_md *); - + int (*m_free_lustre_md)(struct obd_export *, struct lustre_md *); - + int (*m_set_open_replay_data)(struct obd_export *, struct obd_client_handle *, struct ptlrpc_request *); int (*m_clear_open_replay_data)(struct obd_export *, struct obd_client_handle *); int (*m_set_lock_data)(struct obd_export *, __u64 *, void *); - + int (*m_lock_match)(struct obd_export *, int, struct lu_fid *, ldlm_type_t, ldlm_policy_data_t *, ldlm_mode_t, struct lustre_handle *); - + int (*m_cancel_unused)(struct obd_export *, struct lu_fid *, int flags, void *opaque); diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 851cf8a..7371f53 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -670,7 +670,8 @@ static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid) RETURN(rc); } -static inline int obd_connect(struct lustre_handle *conn,struct obd_device *obd, +static inline int obd_connect(const struct lu_context *ctx, + struct lustre_handle *conn,struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *d) { @@ -682,7 +683,7 @@ static inline int obd_connect(struct lustre_handle *conn,struct obd_device *obd, OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, connect); - rc = OBP(obd, connect)(conn, obd, cluuid, d); + rc = OBP(obd, connect)(ctx, conn, obd, cluuid, d); /* check that only subset is granted */ LASSERT(ergo(d != NULL, (d->ocd_connect_flags & ocf) == d->ocd_connect_flags)); diff --git a/lustre/kernel_patches/patches/ext3-iam-separate.patch b/lustre/kernel_patches/patches/ext3-iam-separate.patch index 61178cd..2753355 100644 --- a/lustre/kernel_patches/patches/ext3-iam-separate.patch +++ b/lustre/kernel_patches/patches/ext3-iam-separate.patch @@ -1,7 +1,7 @@ Index: iam/fs/ext3/Makefile =================================================================== --- iam.orig/fs/ext3/Makefile 2006-05-31 20:24:32.000000000 +0400 -+++ iam/fs/ext3/Makefile 2006-07-19 15:20:42.000000000 +0400 ++++ iam/fs/ext3/Makefile 2006-07-19 16:58:55.000000000 +0400 @@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \ @@ -5441,7 +5441,7 @@ Index: iam/fs/ext3/namei.c Index: iam/include/linux/lustre_iam.h =================================================================== --- iam.orig/include/linux/lustre_iam.h 2006-05-31 20:24:32.000000000 +0400 -+++ iam/include/linux/lustre_iam.h 2006-07-19 15:20:42.000000000 +0400 ++++ iam/include/linux/lustre_iam.h 2006-07-19 16:58:55.000000000 +0400 @@ -1,9 +1,68 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: diff --git a/lustre/kernel_patches/patches/ext3-iam-uapi.patch b/lustre/kernel_patches/patches/ext3-iam-uapi.patch index 77bd122..985ecb7 100644 --- a/lustre/kernel_patches/patches/ext3-iam-uapi.patch +++ b/lustre/kernel_patches/patches/ext3-iam-uapi.patch @@ -1,7 +1,7 @@ Index: iam/fs/ext3/Makefile =================================================================== ---- iam.orig/fs/ext3/Makefile 2006-07-19 15:20:42.000000000 +0400 -+++ iam/fs/ext3/Makefile 2006-07-19 15:20:43.000000000 +0400 +--- iam.orig/fs/ext3/Makefile 2006-07-19 16:58:55.000000000 +0400 ++++ iam/fs/ext3/Makefile 2006-07-19 16:58:56.000000000 +0400 @@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \ @@ -13,8 +13,8 @@ Index: iam/fs/ext3/Makefile ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o Index: iam/fs/ext3/dir.c =================================================================== ---- iam.orig/fs/ext3/dir.c 2006-07-19 15:20:42.000000000 +0400 -+++ iam/fs/ext3/dir.c 2006-07-19 15:20:43.000000000 +0400 +--- iam.orig/fs/ext3/dir.c 2006-07-19 16:58:55.000000000 +0400 ++++ iam/fs/ext3/dir.c 2006-07-19 16:58:56.000000000 +0400 @@ -28,6 +28,7 @@ #include #include @@ -112,8 +112,8 @@ Index: iam/fs/ext3/dir.c (filp->f_version != inode->i_version)) { Index: iam/fs/ext3/file.c =================================================================== ---- iam.orig/fs/ext3/file.c 2006-07-19 15:20:42.000000000 +0400 -+++ iam/fs/ext3/file.c 2006-07-19 15:20:43.000000000 +0400 +--- iam.orig/fs/ext3/file.c 2006-07-19 16:58:55.000000000 +0400 ++++ iam/fs/ext3/file.c 2006-07-19 16:58:56.000000000 +0400 @@ -23,6 +23,7 @@ #include #include @@ -149,7 +149,7 @@ Index: iam/fs/ext3/file.c Index: iam/fs/ext3/iam-uapi.c =================================================================== --- iam.orig/fs/ext3/iam-uapi.c 2004-04-06 17:27:52.000000000 +0400 -+++ iam/fs/ext3/iam-uapi.c 2006-07-19 15:20:43.000000000 +0400 ++++ iam/fs/ext3/iam-uapi.c 2006-07-19 16:58:56.000000000 +0400 @@ -0,0 +1,361 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: @@ -514,8 +514,8 @@ Index: iam/fs/ext3/iam-uapi.c +} Index: iam/fs/ext3/ioctl.c =================================================================== ---- iam.orig/fs/ext3/ioctl.c 2006-07-19 15:20:42.000000000 +0400 -+++ iam/fs/ext3/ioctl.c 2006-07-19 15:20:43.000000000 +0400 +--- iam.orig/fs/ext3/ioctl.c 2006-07-19 16:58:55.000000000 +0400 ++++ iam/fs/ext3/ioctl.c 2006-07-19 16:58:56.000000000 +0400 @@ -250,6 +250,6 @@ flags_err: @@ -526,8 +526,8 @@ Index: iam/fs/ext3/ioctl.c } Index: iam/include/linux/lustre_iam.h =================================================================== ---- iam.orig/include/linux/lustre_iam.h 2006-07-19 15:20:42.000000000 +0400 -+++ iam/include/linux/lustre_iam.h 2006-07-19 15:20:43.000000000 +0400 +--- iam.orig/include/linux/lustre_iam.h 2006-07-19 16:58:55.000000000 +0400 ++++ iam/include/linux/lustre_iam.h 2006-07-19 16:58:56.000000000 +0400 @@ -30,9 +30,6 @@ #ifndef __LINUX_LUSTRE_IAM_H__ #define __LINUX_LUSTRE_IAM_H__ diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 08c7f64..09bae06 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -338,7 +338,8 @@ int client_obd_cleanup(struct obd_device *obddev) } /* ->o_connect() method for client side (OSC and MDC and MGC) */ -int client_connect_import(struct lustre_handle *dlm_handle, +int client_connect_import(const struct lu_context *ctx, + struct lustre_handle *dlm_handle, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { @@ -692,7 +693,8 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) rc = -EBUSY; } else { dont_check_exports: - rc = obd_connect(&conn, target, &cluuid, data); + rc = obd_connect(req->rq_svc_thread->t_ctx, + &conn, target, &cluuid, data); } } else { rc = obd_reconnect(export, target, &cluuid, data); @@ -969,7 +971,7 @@ static void reset_recovery_timer(struct obd_device *obd) spin_unlock_bh(&obd->obd_processing_task_lock); return; } - cfs_timer_arm(&obd->obd_recovery_timer, + cfs_timer_arm(&obd->obd_recovery_timer, cfs_time_shift(OBD_RECOVERY_TIMEOUT)); spin_unlock_bh(&obd->obd_processing_task_lock); CDEBUG(D_HA, "%s: timer will expire in %u seconds\n", obd->obd_name, diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c index cdb8f04..36b46f3 100644 --- a/lustre/liblustre/llite_lib.c +++ b/lustre/liblustre/llite_lib.c @@ -134,7 +134,7 @@ int liblustre_process_log(struct config_llog_instance *cfg, strlen(KEY_INIT_RECOV), KEY_INIT_RECOV, sizeof(allow_recov), &allow_recov, NULL); - rc = obd_connect(&mdc_conn, obd, &mdc_uuid, ocd); + rc = obd_connect(NULL, &mdc_conn, obd, &mdc_uuid, ocd); if (rc) { CERROR("cannot connect to %s: rc = %d\n", mdsname, rc); GOTO(out_cleanup, rc); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index f5fa4fc..e14344c 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -346,7 +346,7 @@ static struct inode* llu_new_inode(struct filesys *fs, #endif /* FIXME: fix this later */ .st_mode = 0, - + .st_uid = geteuid(), .st_gid = getegid(), }; @@ -436,7 +436,7 @@ static int llu_inode_revalidate(struct inode *inode) ealen = obd_size_diskmd(sbi->ll_dt_exp, NULL); valid |= OBD_MD_FLEASIZE; } - rc = md_getattr(sbi->ll_md_exp, ll_inode2fid(inode), + rc = md_getattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, ealen, &req); if (rc) { CERROR("failure %d inode %llu\n", rc, @@ -538,7 +538,7 @@ void llu_clear_inode(struct inode *inode) inode); clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags)); - md_change_cbdata(sbi->ll_md_exp, ll_inode2fid(inode), + md_change_cbdata(sbi->ll_md_exp, ll_inode2fid(inode), null_if_equal, inode); if (lli->lli_smd) @@ -1231,7 +1231,7 @@ static int llu_iop_mkdir_raw(struct pnode *pno, mode_t mode) .ph_cname = qstr, .ph_opc = LUSTRE_OPC_MKDIR }; - + int err = -EMLINK; ENTRY; @@ -1299,7 +1299,7 @@ static int llu_file_flock(struct inode *ino, struct ldlm_res_id res_id = { .name = {fid_seq(&lli->lli_fid), fid_oid(&lli->lli_fid), - fid_ver(&lli->lli_fid), + fid_ver(&lli->lli_fid), LDLM_FLOCK} }; struct lustre_handle lockh = {0}; ldlm_policy_data_t flock; @@ -1824,7 +1824,7 @@ llu_fsswop_mount(const char *source, ocd.ocd_version = LUSTRE_VERSION_CODE; /* setup mdc */ - err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, &ocd); + err = obd_connect(NULL, &mdc_conn, obd, &sbi->ll_sb_uuid, &ocd); if (err) { CERROR("cannot connect to %s: rc = %d\n", mdc, err); GOTO(out_free, err); @@ -1858,7 +1858,7 @@ llu_fsswop_mount(const char *source, ocd.ocd_connect_flags = OBD_CONNECT_SRVLOCK|OBD_CONNECT_REQPORTAL| OBD_CONNECT_VERSION|OBD_CONNECT_TRUNCLOCK; ocd.ocd_version = LUSTRE_VERSION_CODE; - err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, &ocd); + err = obd_connect(NULL, &osc_conn, obd, &sbi->ll_sb_uuid, &ocd); if (err) { CERROR("cannot connect to %s: rc = %d\n", osc, err); GOTO(out_mdc, err); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 908498b..c433750 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -68,7 +68,7 @@ struct ll_sb_info *ll_init_sbi(void) sbi->ll_async_page_max = (num_physpages / 4) * 3; sbi->ll_ra_info.ra_max_pages = min(num_physpages / 8, SBI_DEFAULT_READAHEAD_MAX); - sbi->ll_ra_info.ra_max_read_ahead_whole_pages = + sbi->ll_ra_info.ra_max_read_ahead_whole_pages = SBI_DEFAULT_READAHEAD_WHOLE_MAX; INIT_LIST_HEAD(&sbi->ll_conn_chain); @@ -193,7 +193,7 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) /* real client */ data->ocd_connect_flags |= OBD_CONNECT_REAL; - err = obd_connect(&md_conn, obd, &sbi->ll_sb_uuid, data); + err = obd_connect(NULL, &md_conn, obd, &sbi->ll_sb_uuid, data); if (err == -EBUSY) { CERROR("An MDT (mdc %s) is performing recovery, of which this" " client is not a part. Please wait for recovery to " @@ -250,7 +250,7 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) CERROR("can't init FIDs framework, rc %d\n", err); GOTO(out_mdc, err); } - + obd = class_name2obd(osc); if (!obd) { CERROR("OSC %s: not setup or attached\n", osc); @@ -267,7 +267,7 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) obd->obd_upcall.onu_owner = &sbi->ll_lco; obd->obd_upcall.onu_upcall = ll_ocd_update; - err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, data); + err = obd_connect(NULL, &osc_conn, obd, &sbi->ll_sb_uuid, data); if (err == -EBUSY) { CERROR("An OST (osc %s) is performing recovery, of which this" " client is not a part. Please wait for recovery to " @@ -311,7 +311,7 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) CERROR("can't init FIDs framework, rc %d\n", err); GOTO(out_osc, err); } - + err = md_getstatus(sbi->ll_md_exp, &rootfid); if (err) { CERROR("cannot mds_connect: rc = %d\n", err); @@ -749,14 +749,14 @@ void ll_put_super(struct super_block *sb) /* We need to set force before the lov_disconnect in lustre_common_put_super, since l_d cleans up osc's as well. */ next = 0; - while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) + while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) != NULL) { obd->obd_force = force; } } client_common_put_super(sb); - + next = 0; while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) !=NULL) { class_manual_cleanup(obd); @@ -1073,14 +1073,14 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) CDEBUG(D_INODE, "set mtime on OST inode %lu to %lu\n", inode->i_ino, LTIME_S(attr->ia_mtime)); - + oa.o_id = lsm->lsm_object_id; oa.o_valid = OBD_MD_FLID; flags = OBD_MD_FLTYPE | OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLFID | OBD_MD_FLGENER; - + obdo_from_inode(&oa, inode, flags); rc = obd_setattr(sbi->ll_dt_exp, &oa, lsm, NULL); if (rc) @@ -1210,10 +1210,10 @@ void ll_inode_size_unlock(struct inode *inode, int unlock_lsm) static void ll_replace_lsm(struct inode *inode, struct lov_stripe_md *lsm) { struct ll_inode_info *lli = ll_i2info(inode); - + dump_lsm(D_INODE, lsm); - dump_lsm(D_INODE, lli->lli_smd); - LASSERTF(lsm->lsm_magic == LOV_MAGIC_JOIN, + dump_lsm(D_INODE, lli->lli_smd); + LASSERTF(lsm->lsm_magic == LOV_MAGIC_JOIN, "lsm must be joined lsm %p\n", lsm); obd_free_memmd(ll_i2dtexp(inode), &lli->lli_smd); CDEBUG(D_INODE, "replace lsm %p to lli_smd %p for inode %lu%u(%p)\n", @@ -1233,7 +1233,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)); if (lsm != NULL) { if (lli->lli_smd == NULL) { - if (lsm->lsm_magic != LOV_MAGIC && + if (lsm->lsm_magic != LOV_MAGIC && lsm->lsm_magic != LOV_MAGIC_JOIN) { dump_lsm(D_ERROR, lsm); LBUG(); @@ -1249,7 +1249,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) lli->lli_maxbytes = PAGE_CACHE_MAXBYTES; } else { if (lli->lli_smd->lsm_magic == lsm->lsm_magic && - lli->lli_smd->lsm_stripe_count == + lli->lli_smd->lsm_stripe_count == lsm->lsm_stripe_count) { if (lov_stripe_md_cmp(lli->lli_smd, lsm)) { CERROR("lsm mismatch for inode %ld\n", @@ -1260,7 +1260,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) dump_lsm(D_ERROR, lsm); LBUG(); } - } else + } else ll_replace_lsm(inode, lsm); } /* bug 2844 - limit i_blksize for broken user-space apps */ @@ -1324,7 +1324,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) if (body->valid & OBD_MD_FLID) lli->lli_fid = body->fid1; - + LASSERT(fid_seq(&lli->lli_fid) != 0); } @@ -1404,7 +1404,7 @@ void ll_delete_inode(struct inode *inode) if (rc) { CERROR("fid_delete() failed, rc %d\n", rc); } - + EXIT; } @@ -1555,18 +1555,18 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) struct ll_sb_info *sbi = ll_s2sbi(sb); int err; __u32 read_only; - + if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { read_only = *flags & MS_RDONLY; err = obd_set_info_async(sbi->ll_md_exp, strlen("read-only"), - "read-only", sizeof(read_only), + "read-only", sizeof(read_only), &read_only, NULL); if (err) { CERROR("Failed to change the read-only flag during " "remount: %d\n", err); return err; } - + if (read_only) sb->s_flags |= MS_RDONLY; else @@ -1601,7 +1601,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, * client generated for creating some inode. So using ->fid1 is * okay here. */ LASSERT(fid_is_sane(&md.body->fid1)); - + *inode = ll_iget(sb, ll_fid_build_ino(sbi, &md.body->fid1), &md); if (*inode == NULL || is_bad_inode(*inode)) { md_free_lustre_md(sbi->ll_dt_exp, &md); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index fa837c7..66969a5 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -161,7 +161,8 @@ static int lmv_notify(struct obd_device *obd, struct obd_device *watched, /* this is fake connect function. Its purpose is to initialize lmv and say * caller that everything is okay. Real connection will be performed later. */ -static int lmv_connect(struct lustre_handle *conn, struct obd_device *obd, +static int lmv_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { #ifdef __KERNEL__ @@ -330,7 +331,7 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) RETURN(-EINVAL); } - rc = obd_connect(&conn, mdc_obd, &lmv_mdc_uuid, &lmv->conn_data); + rc = obd_connect(NULL, &conn, mdc_obd, &lmv_mdc_uuid, &lmv->conn_data); if (rc) { CERROR("target %s connect error %d\n", tgt->uuid.uuid, rc); RETURN(rc); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 7688122..cb2a4f9 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -144,7 +144,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, RETURN(0); } - rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, data); + rc = obd_connect(NULL, &conn, tgt_obd, &lov_osc_uuid, data); if (rc) { CERROR("Target %s connect error %d\n", obd_uuid2str(tgt_uuid), rc); @@ -194,7 +194,8 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, RETURN(0); } -static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, +static int lov_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { struct lov_obd *lov = &obd->u.lov; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index ee11b07..0082869 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -310,7 +310,8 @@ static int mds_reconnect(struct obd_export *exp, struct obd_device *obd, * about that client, like open files, the last operation number it did * on the server, etc. */ -static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, +static int mds_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { struct obd_export *exp; diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 78464de..fb51ca7 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -57,11 +57,11 @@ void md_lov_info_update_objids(struct md_lov_info *mli, obd_id *ids) void mds_lov_update_objids(struct obd_device *obd, obd_id *ids) { struct mds_obd *mds = &obd->u.mds; - + md_lov_info_update_objids(&mds->mds_lov_info, ids); } -static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli, +static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli, const void *ctxt) { struct file *filp = (struct file *)mli->md_lov_objid_obj; @@ -73,8 +73,8 @@ static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli, LASSERT(!mli->md_lov_objids_size); LASSERT(!mli->md_lov_objids_dirty); - /* Read everything in the file, even if our current lov desc - has fewer targets. Old targets not in the lov descriptor + /* Read everything in the file, even if our current lov desc + has fewer targets. Old targets not in the lov descriptor during mds setup may still have valid objids. */ size = filp->f_dentry->d_inode->i_size; if (size == 0) @@ -91,9 +91,9 @@ static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli, CERROR("Error reading objids %d\n", rc); RETURN(rc); } - - mli->md_lov_objids_in_file = size / sizeof(*ids); - + + mli->md_lov_objids_in_file = size / sizeof(*ids); + for (i = 0; i < mli->md_lov_objids_in_file; i++) { CDEBUG(D_INFO, "read last object "LPU64" for idx %d\n", mli->md_lov_objids[i], i); @@ -101,12 +101,12 @@ static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli, RETURN(0); } -int mds_lov_write_objids(struct obd_device *obd, struct md_lov_info *mli, +int mds_lov_write_objids(struct obd_device *obd, struct md_lov_info *mli, const void *ctxt) { struct file *filp = (struct file *)mli->md_lov_objid_obj; loff_t off = 0; - int i, rc, tgts; + int i, rc, tgts; ENTRY; if (!mli->md_lov_objids_dirty) @@ -121,7 +121,7 @@ int mds_lov_write_objids(struct obd_device *obd, struct md_lov_info *mli, CDEBUG(D_INFO, "writing last object "LPU64" for idx %d\n", mli->md_lov_objids[i], i); - rc = fsfilt_write_record(obd, filp, mli->md_lov_objids, + rc = fsfilt_write_record(obd, filp, mli->md_lov_objids, tgts * sizeof(obd_id), &off, 0); if (rc >= 0) { @@ -168,7 +168,7 @@ int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid) } /* update the LOV-OSC knowledge of the last used object id's */ -static int md_lov_info_set_nextid(struct obd_device *obd, +static int md_lov_info_set_nextid(struct obd_device *obd, struct md_lov_info *mli) { int rc; @@ -193,7 +193,7 @@ int mds_lov_set_nextid(struct obd_device *obd) int md_lov_info_update_desc(struct md_lov_info *mli, struct obd_export *lov) { - struct lov_desc *ld; + struct lov_desc *ld; __u32 size, stripes, valsize = sizeof(mli->md_lov_desc); int rc = 0; ENTRY; @@ -209,13 +209,13 @@ int md_lov_info_update_desc(struct md_lov_info *mli, struct obd_export *lov) /* The size of the LOV target table may have increased. */ size = ld->ld_tgt_count * sizeof(obd_id); - if ((mli->md_lov_objids_size == 0) || + if ((mli->md_lov_objids_size == 0) || (size > mli->md_lov_objids_size)) { obd_id *ids; - + /* add room by powers of 2 */ size = 1; - while (size < ld->ld_tgt_count) + while (size < ld->ld_tgt_count) size = size << 1; size = size * sizeof(obd_id); @@ -225,7 +225,7 @@ int md_lov_info_update_desc(struct md_lov_info *mli, struct obd_export *lov) memset(ids, 0, size); if (mli->md_lov_objids_size) { obd_id *old_ids = mli->md_lov_objids; - memcpy(ids, mli->md_lov_objids, + memcpy(ids, mli->md_lov_objids, mli->md_lov_objids_size); mli->md_lov_objids = ids; OBD_FREE(old_ids, mli->md_lov_objids_size); @@ -240,7 +240,7 @@ int md_lov_info_update_desc(struct md_lov_info *mli, struct obd_export *lov) CDEBUG(D_CONFIG, "updated lov_desc, tgt_count: %d\n", mli->md_lov_desc.ld_tgt_count); - stripes = min((__u32)LOV_MAX_STRIPE_COUNT, + stripes = min((__u32)LOV_MAX_STRIPE_COUNT, max(mli->md_lov_desc.ld_tgt_count, mli->md_lov_objids_in_file)); @@ -258,7 +258,7 @@ out: /* Inform MDS about new/updated target */ static int mds_lov_update_mds(struct obd_device *obd, struct md_lov_info *mli, - struct obd_device *watched, + struct obd_device *watched, __u32 idx, const void *ctxt) { int old_count; @@ -277,17 +277,17 @@ static int mds_lov_update_mds(struct obd_device *obd, /* idx is set as data from lov_notify. */ if (idx != MDSLOV_NO_INDEX && !obd->obd_recovering) { if (idx >= mli->md_lov_desc.ld_tgt_count) { - CERROR("index %d > count %d!\n", idx, + CERROR("index %d > count %d!\n", idx, mli->md_lov_desc.ld_tgt_count); RETURN(-EINVAL); } - + if (idx >= mli->md_lov_objids_in_file) { /* We never read this lastid; ask the osc */ obd_id lastid; __u32 size = sizeof(lastid); rc = obd_get_info(watched->obd_self_export, - strlen("last_id"), + strlen("last_id"), "last_id", &size, &lastid); if (rc) RETURN(rc); @@ -296,10 +296,10 @@ static int mds_lov_update_mds(struct obd_device *obd, mli->md_lov_ops->ml_write_objids(obd, mli, ctxt); } else { /* We have read this lastid from disk; tell the osc. - Don't call this during recovery. */ + Don't call this during recovery. */ rc = md_lov_info_set_nextid(obd, mli); } - + CDEBUG(D_CONFIG, "last object "LPU64" from OST %d\n", mli->md_lov_objids[idx], idx); } @@ -320,7 +320,7 @@ static int mds_lov_update_mds(struct obd_device *obd, } int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli, - char *lov_name, struct obd_uuid *uuid, + char *lov_name, struct obd_uuid *uuid, struct md_lov_ops *mlo, const void *ctxt) { struct lustre_handle conn = {0,}; @@ -340,7 +340,7 @@ int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli, RETURN(-ENOTCONN); } - mli->md_lov_ops = mlo; + mli->md_lov_ops = mlo; OBD_ALLOC(data, sizeof(*data)); if (data == NULL) @@ -348,9 +348,9 @@ int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli, data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_INDEX | OBD_CONNECT_REQPORTAL; data->ocd_version = LUSTRE_VERSION_CODE; - + /* NB: lov_connect() needs to fill in .ocd_index for each OST */ - rc = obd_connect(&conn, mli->md_lov_obd, uuid, data); + rc = obd_connect(NULL, &conn, mli->md_lov_obd, uuid, data); OBD_FREE(data, sizeof(*data)); if (rc) { CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc); @@ -366,7 +366,7 @@ int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli, } CDEBUG(D_INFO, "regist observer %s to lov %s \n", obd->obd_name, mli->md_lov_obd->obd_name); - + rc = mli->md_lov_ops->ml_read_objids(obd, mli, ctxt); if (rc) { CERROR("cannot read %s: rc = %d\n", "lov_objids", rc); @@ -381,7 +381,7 @@ out: } EXPORT_SYMBOL(md_lov_connect); -int md_lov_update_objids(struct obd_device *obd, struct md_lov_info *mli, +int md_lov_update_objids(struct obd_device *obd, struct md_lov_info *mli, const void *ctxt) { int rc = 0, i; @@ -414,7 +414,7 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) int rc; ENTRY; - rc = md_lov_connect(obd, mli, lov_name, &obd->obd_uuid, &mli_ops, + rc = md_lov_connect(obd, mli, lov_name, &obd->obd_uuid, &mli_ops, NULL); if (rc) GOTO(err_reg, rc); @@ -429,7 +429,7 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) /* If we're mounting this code for the first time on an existing FS, * we need to populate the objids array from the real OST values */ rc = md_lov_update_objids(obd, mli, NULL); - + /* I want to see a callback happen when the OBD moves to a * "For General Use" state, and that's when we'll call * set_nextid(). The class driver can help us here, because @@ -668,7 +668,7 @@ int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct mds_lov_sync_info { struct obd_device *mlsi_obd; /* the lov device to sync */ - struct md_lov_info *mlsi_mli; + struct md_lov_info *mlsi_mli; struct obd_device *mlsi_watched; /* target osc */ __u32 mlsi_index; /* index of target */ const void *mlsi_ctxt; @@ -676,9 +676,9 @@ struct mds_lov_sync_info { /* We only sync one osc at a time, so that we don't have to hold - any kind of lock on the whole mds_lov_desc, which may change + any kind of lock on the whole mds_lov_desc, which may change (grow) as a result of mds_lov_add_ost. This also avoids any - kind of mismatch between the lov_desc and the mds_lov_desc, + kind of mismatch between the lov_desc and the mds_lov_desc, which are not in lock-step during lov_add_obd */ static int __mds_lov_synchronize(void *data) { @@ -702,7 +702,7 @@ static int __mds_lov_synchronize(void *data) rc = mds_lov_update_mds(obd, mli, watched, idx, ctxt); if (rc != 0) GOTO(out, rc); - + rc = obd_set_info_async(mli->md_lov_exp, strlen(KEY_MDS_CONN), KEY_MDS_CONN, 0, uuid, NULL); if (rc != 0) @@ -712,7 +712,7 @@ static int __mds_lov_synchronize(void *data) rc = llog_connect(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT), mds->mds_lov_desc.ld_tgt_count, NULL, NULL, uuid); - + if (rc != 0) { CERROR("%s: failed at llog_origin_connect: %d\n", obd->obd_name, rc); @@ -767,7 +767,7 @@ int md_lov_start_synchronize(struct obd_device *obd, struct md_lov_info *mli, mlsi->mlsi_watched = watched; mlsi->mlsi_mli = mli; mlsi->mlsi_ctxt = ctxt; - if (data) + if (data) mlsi->mlsi_index = *(__u32 *)data; else mlsi->mlsi_index = MDSLOV_NO_INDEX; @@ -802,7 +802,7 @@ int md_lov_start_synchronize(struct obd_device *obd, struct md_lov_info *mli, } EXPORT_SYMBOL(md_lov_start_synchronize); -int mds_lov_start_synchronize(struct obd_device *obd, +int mds_lov_start_synchronize(struct obd_device *obd, struct obd_device *watched, void *data, int nonblock) { @@ -836,9 +836,9 @@ int md_lov_notity_pre(struct obd_device *obd, struct md_lov_info *mli, if (obd->obd_recovering) { CWARN("MDS %s: in recovery, not resetting orphans on %s\n", - obd->obd_name, + obd->obd_name, obd_uuid2str(&watched->u.cli.cl_target_uuid)); - /* We still have to fix the lov descriptor for ost's added + /* We still have to fix the lov descriptor for ost's added after the mdt in the config log. They didn't make it into mds_lov_connect. */ rc = md_lov_info_update_desc(mli, mli->md_lov_exp); @@ -863,7 +863,7 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched, } LASSERT(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT) != NULL); - rc = mds_lov_start_synchronize(obd, watched, data, + rc = mds_lov_start_synchronize(obd, watched, data, !(ev == OBD_NOTIFY_SYNC)); lquota_recovery(quota_interface, obd); @@ -891,14 +891,14 @@ int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, int rc, err; ENTRY; - if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC || + if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC || le32_to_cpu(lmm->lmm_magic == LOV_MAGIC_JOIN)) RETURN(0); CDEBUG(D_INODE, "converting LOV EA on %lu/%u from %#08x to %#08x\n", inode->i_ino, inode->i_generation, le32_to_cpu(lmm->lmm_magic), LOV_MAGIC); - + rc = obd_unpackmd(obd->u.mds.mds_osc_exp, &lsm, lmm, lmm_size); if (rc < 0) GOTO(conv_end, rc); diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c index 0ed3a82..8332af9 100644 --- a/lustre/mdt/mdt_fs.c +++ b/lustre/mdt/mdt_fs.c @@ -327,8 +327,9 @@ static int mdt_init_server_data(const struct lu_context *ctxt, last_transno = le64_to_cpu(mcd->mcd_last_transno); - /* These exports are cleaned up by mdt_obd_disconnect(), so they - * need to be set up like real exports as mdt_obd_connect() does. + /* These exports are cleaned up by mdt_obd_disconnect(), so + * they need to be set up like real exports as + * mdt_obd_connect() does. */ CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64 " srv lr: "LPU64" lx: "LPU64"\n", mcd->mcd_uuid, cl_idx, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 63cb70e..064fe3a 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -83,22 +83,30 @@ enum mdt_handler_flags { /* * struct mdt_body is passed in the incoming message, and object * identified by this fid exists on disk. + * + * "habeo corpus" == "I have a body" */ HABEO_CORPUS = (1 << 0), /* * struct ldlm_request is passed in the incoming message. + * + * "habeo clavis" == "I have a key" */ HABEO_CLAVIS = (1 << 1), /* * this request has fixed reply format, so that reply message can be * packed by generic code. + * + * "habeo refero" == "I have a reply" */ HABEO_REFERO = (1 << 2), /* * this request will modify something, so check whether the filesystem * is readonly or not, then return -EROFS to client asap if necessary. + * + * "mutabor" == "I shall modify" */ - HABEO_MUTABOR = (1 << 3) + MUTABOR = (1 << 3) }; struct mdt_opc_slice { @@ -1036,10 +1044,10 @@ static int mdt_req_handle(struct mdt_thread_info *info, } - if (result == 0 && flags & HABEO_MUTABOR) { - if (req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY) - result = -EROFS; - } + if (result == 0 && flags & MUTABOR && + req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY) + result = -EROFS; + if (result == 0 && flags & HABEO_CLAVIS) { struct ldlm_request *dlm_req; @@ -1346,13 +1354,13 @@ static struct mdt_it_flavor { }, [MDT_IT_OCREAT] = { .it_fmt = &RQF_LDLM_INTENT, - .it_flags = HABEO_MUTABOR, + .it_flags = MUTABOR, .it_act = mdt_intent_reint, .it_reint = REINT_OPEN }, [MDT_IT_CREATE] = { .it_fmt = &RQF_LDLM_INTENT, - .it_flags = HABEO_MUTABOR, + .it_flags = MUTABOR, .it_act = mdt_intent_reint, .it_reint = REINT_CREATE }, @@ -1373,13 +1381,13 @@ static struct mdt_it_flavor { }, [MDT_IT_UNLINK] = { .it_fmt = &RQF_LDLM_INTENT_UNLINK, - .it_flags = HABEO_MUTABOR, + .it_flags = MUTABOR, .it_act = NULL, /* XXX can be mdt_intent_reint, ? */ .it_reint = REINT_UNLINK }, [MDT_IT_TRUNC] = { .it_fmt = NULL, - .it_flags = HABEO_MUTABOR, + .it_flags = MUTABOR, .it_act = NULL }, [MDT_IT_GETXATTR] = { @@ -1587,7 +1595,7 @@ static int mdt_intent_opc(long itopc, struct mdt_thread_info *info, rc = mdt_unpack_req_pack_rep(info, flv->it_flags); if (rc == 0) { struct ptlrpc_request *req = mdt_info_req(info); - if (flv->it_flags & HABEO_MUTABOR && + if (flv->it_flags & MUTABOR && req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY) rc = -EROFS; } @@ -1749,7 +1757,7 @@ static int mdt_seq_init_ctlr(const struct lu_context *ctx, CDEBUG(D_CONFIG, "connect to controller %s(%s)\n", mdc->obd_name, mdc->obd_uuid.uuid); - rc = obd_connect(&conn, mdc, &mdc->obd_uuid, NULL); + rc = obd_connect(ctx, &conn, mdc, &mdc->obd_uuid, NULL); if (rc) { CERROR("target %s connect error %d\n", @@ -2319,7 +2327,8 @@ static int mdt_connect0(struct mdt_device *mdt, } /* mds_connect copy */ -static int mdt_obd_connect(struct lustre_handle *conn, struct obd_device *obd, +static int mdt_obd_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { @@ -2327,10 +2336,10 @@ static int mdt_obd_connect(struct lustre_handle *conn, struct obd_device *obd, struct mdt_device *mdt; struct mdt_export_data *med; struct mdt_client_data *mcd; - struct lu_context ctxt; int rc; ENTRY; + LASSERT(ctx != NULL); if (!conn || !obd || !cluuid) RETURN(-EINVAL); @@ -2350,15 +2359,9 @@ static int mdt_obd_connect(struct lustre_handle *conn, struct obd_device *obd, if (mcd != NULL) { memcpy(mcd->mcd_uuid, cluuid, sizeof mcd->mcd_uuid); med->med_mcd = mcd; - rc = lu_context_init(&ctxt, LCT_MD_THREAD); - if (rc == 0) { - lu_context_enter(&ctxt); - /* - * rc = mdt_client_add(&ctxt, mdt, med, -1); - */ - lu_context_exit(&ctxt); - lu_context_fini(&ctxt); - } + /* + * rc = mdt_client_add(ctx, mdt, med, -1); + */ if (rc != 0) OBD_FREE_PTR(mcd); } else @@ -2673,12 +2676,12 @@ DEF_MDT_HNDL_F(0, DISCONNECT, mdt_disconnect), DEF_MDT_HNDL_F(0 |HABEO_REFERO, GETSTATUS, mdt_getstatus), DEF_MDT_HNDL_F(HABEO_CORPUS, GETATTR, mdt_getattr), DEF_MDT_HNDL_F(HABEO_CORPUS, GETATTR_NAME, mdt_getattr_name), -DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO|HABEO_MUTABOR, +DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO|MUTABOR, SETXATTR, mdt_setxattr), DEF_MDT_HNDL_F(HABEO_CORPUS, GETXATTR, mdt_getxattr), DEF_MDT_HNDL_F(0 |HABEO_REFERO, STATFS, mdt_statfs), DEF_MDT_HNDL_F(HABEO_CORPUS, READPAGE, mdt_readpage), -DEF_MDT_HNDL_F(0 |HABEO_MUTABOR, +DEF_MDT_HNDL_F(0 |MUTABOR, REINT, mdt_reint), DEF_MDT_HNDL_F(HABEO_CORPUS|HABEO_REFERO, CLOSE, mdt_close), DEF_MDT_HNDL_0(0, DONE_WRITING, mdt_done_writing), diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 97fbaff..3f026f9 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -130,8 +130,8 @@ struct mdt_device { * or should be placed somewhere else. */ int mdt_max_mdsize; int mdt_max_cookiesize; - __u64 mdt_mount_count; - + __u64 mdt_mount_count; + struct mdt_server_data mdt_msd; unsigned long mdt_client_bitmap[(LR_MAX_CLIENTS >> 3) / sizeof(long)]; }; @@ -270,13 +270,13 @@ static inline struct ptlrpc_request *mdt_info_req(struct mdt_thread_info *info) return info->mti_pill.rc_req; } -static inline void mdt_object_get(const struct lu_context *ctxt, +static inline void mdt_object_get(const struct lu_context *ctxt, struct mdt_object *o) { lu_object_get(&o->mot_obj.mo_lu); } -static inline void mdt_object_put(const struct lu_context *ctxt, +static inline void mdt_object_put(const struct lu_context *ctxt, struct mdt_object *o) { lu_object_put(ctxt, &o->mot_obj.mo_lu); @@ -289,27 +289,27 @@ static inline const struct lu_fid *mdt_object_fid(struct mdt_object *o) int mdt_object_lock(struct mdt_thread_info *, struct mdt_object *, - struct mdt_lock_handle *, + struct mdt_lock_handle *, __u64); -void mdt_object_unlock(struct mdt_thread_info *, +void mdt_object_unlock(struct mdt_thread_info *, struct mdt_object *, struct mdt_lock_handle *); struct mdt_object *mdt_object_find(const struct lu_context *, - struct mdt_device *, + struct mdt_device *, const struct lu_fid *); struct mdt_object *mdt_object_find_lock(struct mdt_thread_info *, const struct lu_fid *, struct mdt_lock_handle *, __u64); -void mdt_object_unlock_put(struct mdt_thread_info *, +void mdt_object_unlock_put(struct mdt_thread_info *, struct mdt_object *, struct mdt_lock_handle *); int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op); int mdt_reint_rec(struct mdt_thread_info *); -void mdt_pack_attr2body(struct mdt_body *b, struct lu_attr *attr, +void mdt_pack_attr2body(struct mdt_body *b, struct lu_attr *attr, const struct lu_fid *fid); int mdt_getxattr(struct mdt_thread_info *info); @@ -343,7 +343,7 @@ int mdt_client_add(const struct lu_context *ctxt, int mdt_pin(struct mdt_thread_info* info); -int mdt_lock_new_child(struct mdt_thread_info *info, +int mdt_lock_new_child(struct mdt_thread_info *info, struct mdt_object *o, struct mdt_lock_handle *child_lockh); diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index f67a4ad..73f1793 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -49,7 +49,8 @@ /* Establish a connection to the MGS.*/ -static int mgs_connect(struct lustre_handle *conn, struct obd_device *obd, +static int mgs_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { struct obd_export *exp; diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index b214d1d..94edfc9 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -461,7 +461,8 @@ static int llog_test_6(struct obd_device *obd, char *name) RETURN(-ENOENT); } - rc = obd_connect(&exph, mdc_obd, &uuid, NULL /* obd_connect_data */); + rc = obd_connect(NULL, + &exph, mdc_obd, &uuid, NULL /* obd_connect_data */); if (rc) { CERROR("6: failed to connect to MDC: %s\n", mdc_obd->obd_name); RETURN(rc); diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index f31b886..670c17a 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -574,6 +574,10 @@ int lu_context_key_register(struct lu_context_key *key) int result; int i; + LASSERT(key->lct_init != NULL); + LASSERT(key->lct_fini != NULL); + LASSERT(key->lct_tags != 0); + result = -ENFILE; spin_lock(&lu_keys_guard); for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) { diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index beb700c3..13b03cb 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -34,12 +34,12 @@ #include #include #include -#include +#include #include #include #include #include - + static int (*client_fill_super)(struct super_block *sb) = NULL; /*********** string parsing utils *********/ @@ -125,7 +125,7 @@ static struct lustre_mount_info *server_find_mount(const char *name) list_for_each(tmp, &server_mount_info_list) { lmi = list_entry(tmp, struct lustre_mount_info, lmi_list_chain); - if (strcmp(name, lmi->lmi_name) == 0) + if (strcmp(name, lmi->lmi_name) == 0) RETURN(lmi); } RETURN(NULL); @@ -204,7 +204,7 @@ static int server_deregister_mount(const char *name) /* Deregister anyone referencing the mnt. Everyone should have put_mount in *_cleanup, but this is a catch-all in case of err... */ /* FIXME this should be removed from lustre_free_lsi, which may be called - from server_put_mount _before_ it gets to server_deregister_mount. + from server_put_mount _before_ it gets to server_deregister_mount. Leave it here for now for the error message it shows... */ static void server_deregister_mount_all(struct vfsmount *mnt) { @@ -251,8 +251,8 @@ struct lustre_mount_info *server_get_mount(const char *name) lsi = s2lsi(lmi->lmi_sb); mntget(lmi->lmi_mnt); atomic_inc(&lsi->lsi_mounts); - - CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d, vfscount=%d\n", + + CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d, vfscount=%d\n", lmi->lmi_mnt, name, atomic_read(&lsi->lsi_mounts), atomic_read(&lmi->lmi_mnt->mnt_count)); @@ -629,7 +629,7 @@ static int lustre_start_mgc(struct super_block *sb) or not? If there's truly one MGS per site, the MGS uuids _should_ all be the same. Maybe check here? */ - + /* If we are restarting the MGS, don't try to keep the MGC's old connection, or registration will fail. */ if ((lsi->lsi_flags & LSI_SERVER) && IS_MGS(lsi->lsi_ldd)) { @@ -637,7 +637,7 @@ static int lustre_start_mgc(struct super_block *sb) recov_bk = 1; } - /* Try all connections, but only once (again). + /* Try all connections, but only once (again). We don't want to block another target from starting (using its local copy of the log), but we do want to connect if at all possible. */ @@ -738,10 +738,10 @@ static int lustre_start_mgc(struct super_block *sb) /* Try all connections, but only once. */ recov_bk = 1; rc = obd_set_info_async(obd->obd_self_export, - strlen(KEY_INIT_RECOV_BACKUP), + strlen(KEY_INIT_RECOV_BACKUP), KEY_INIT_RECOV_BACKUP, sizeof(recov_bk), &recov_bk, NULL); - if (rc) + if (rc) /* nonfatal */ CERROR("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc); @@ -749,7 +749,7 @@ static int lustre_start_mgc(struct super_block *sb) //ocd.ocd_connect_flags = OBD_CONNECT_ACL; /* We connect to the MGS at setup, and don't disconnect until cleanup */ - rc = obd_connect(&mgc_conn, obd, &(obd->obd_uuid), &ocd); + rc = obd_connect(NULL, &mgc_conn, obd, &(obd->obd_uuid), &ocd); if (rc) { CERROR("connect failed %d\n", rc); GOTO(out, rc); @@ -846,7 +846,7 @@ static int server_mgc_clear_fs(struct obd_device *mgc) ENTRY; CDEBUG(D_MOUNT, "Unassign mgc disk\n"); - + rc = obd_set_info_async(mgc->obd_self_export, strlen("clear_fs"), "clear_fs", 0, NULL, NULL); @@ -985,7 +985,7 @@ int server_register_target(struct super_block *sb) char *label; int err; CDEBUG(D_MOUNT, "Changing on-disk index from %#x to %#x " - "for %s\n", ldd->ldd_svindex, mti->mti_stripe_index, + "for %s\n", ldd->ldd_svindex, mti->mti_stripe_index, mti->mti_svname); ldd->ldd_svindex = mti->mti_stripe_index; strncpy(ldd->ldd_svname, mti->mti_svname, @@ -997,7 +997,7 @@ int server_register_target(struct super_block *sb) if (err) CERROR("Label set error %d\n", err); label = fsfilt_get_label(mgc, lsi->lsi_srv_mnt->mnt_sb); - if (label) + if (label) CDEBUG(D_MOUNT, "Disk label changed to %s\n", label); } @@ -1307,12 +1307,12 @@ static void server_put_super(struct super_block *sb) ENTRY; LASSERT(lsiflags & LSI_SERVER); - + tmpname_sz = strlen(lsi->lsi_ldd->ldd_svname) + 1; OBD_ALLOC(tmpname, tmpname_sz); memcpy(tmpname, lsi->lsi_ldd->ldd_svname, tmpname_sz); CDEBUG(D_MOUNT, "server put_super %s\n", tmpname); - + /* Stop the target */ if (IS_MDT(lsi->lsi_ldd) || IS_OST(lsi->lsi_ldd)) { diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index a923d63..e0e55b7 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -49,7 +49,8 @@ enum { LPROC_ECHO_LAST = LPROC_ECHO_WRITE_BYTES +1 }; -static int echo_connect(struct lustre_handle *conn, struct obd_device *obd, +static int echo_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) { data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index c24533e..198cd25 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -423,9 +423,9 @@ echo_get_stripe_off_id (struct lov_stripe_md *lsm, obd_off *offp, obd_id *idp) *offp = offset * stripe_size + woffset % stripe_size; } -static void -echo_client_page_debug_setup(struct lov_stripe_md *lsm, - cfs_page_t *page, int rw, obd_id id, +static void +echo_client_page_debug_setup(struct lov_stripe_md *lsm, + cfs_page_t *page, int rw, obd_id id, obd_off offset, obd_off count) { char *addr; @@ -454,8 +454,8 @@ echo_client_page_debug_setup(struct lov_stripe_md *lsm, cfs_kunmap(page); } -static int echo_client_page_debug_check(struct lov_stripe_md *lsm, - cfs_page_t *page, obd_id id, +static int echo_client_page_debug_check(struct lov_stripe_md *lsm, + cfs_page_t *page, obd_id id, obd_off offset, obd_off count) { obd_off stripe_off; @@ -848,8 +848,8 @@ static int echo_client_async_page(struct obd_export *exp, int rw, if (oa->o_id != ECHO_PERSISTENT_OBJID && (oa->o_valid & OBD_MD_FLFLAGS) != 0 && (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0) - echo_client_page_debug_setup(lsm, eap->eap_page, rw, - oa->o_id, + echo_client_page_debug_setup(lsm, eap->eap_page, rw, + oa->o_id, eap->eap_off, CFS_PAGE_SIZE); /* always asserts urgent, which isn't quite right */ @@ -1354,7 +1354,7 @@ static int echo_client_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) ocd->ocd_connect_flags = OBD_CONNECT_VERSION; ocd->ocd_version = LUSTRE_VERSION_CODE; - rc = obd_connect(&conn, tgt, &echo_uuid, ocd); + rc = obd_connect(NULL, &conn, tgt, &echo_uuid, ocd); OBD_FREE(ocd, sizeof(*ocd)); @@ -1399,7 +1399,8 @@ static int echo_client_cleanup(struct obd_device *obddev) RETURN(rc); } -static int echo_client_connect(struct lustre_handle *conn, +static int echo_client_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *data) { diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 02438ba..4daebaa 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1812,7 +1812,8 @@ static int filter_reconnect(struct obd_export *exp, struct obd_device *obd, } /* nearly identical to mds_connect */ -static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, +static int filter_connect(const struct lu_context *ctx, + struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) {