From: brian Date: Wed, 10 Aug 2005 17:16:58 +0000 (+0000) Subject: Backout "liblustre now builds" commit. It breaks building in utils: X-Git-Tag: v1_7_100~942 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4ff551e15e6f0aff75520abe6e6e06c0e377a765 Backout "liblustre now builds" commit. It breaks building in utils: ../../lustre/include/linux/lustre_sec.h:541: error: field `c_hash' has incomplete type --- diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index c5446ff..56ed008 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -70,56 +70,6 @@ typedef unsigned short umode_t; #define smp_processor_id() 0 #endif -#ifndef smp_mb -#define smp_mb() do {} while (0) -#endif - -#ifndef might_sleep_if -#define might_sleep_if(cond) do {} while (0) -#endif - -#ifndef might_sleep -#define might_sleep() do {} while (0) -#endif - -#ifndef signal_pending -#define signal_pending(proc) 0 -#endif - -#ifndef MAY_EXEC -#define MAY_EXEC 1 -#endif - -#ifndef MAY_WRITE -#define MAY_WRITE 2 -#endif - -#ifndef MAY_READ -#define MAY_READ 4 -#endif - -#ifndef MAY_APPEND -#define MAY_APPEND 8 -#endif - -#ifndef FMODE_READ -#define FMODE_READ 1 -#endif - -#ifndef FMODE_WRITE -#define FMODE_WRITE 2 -#endif - -#ifndef FMODE_EXEC -#define FMODE_EXEC 4 -#endif - -#define LBUG() \ - do { \ - printf("!!!LBUG at %s:%d\n", __FILE__, __LINE__); \ - sleep(1000000); \ - } while (0) - /* always adopt 2.5 definitions */ #define KERNEL_VERSION(a,b,c) ((a)*100+(b)*10+c) #define LINUX_VERSION_CODE (2*200+5*10+0) @@ -172,7 +122,7 @@ static inline void *kmalloc(int size, int prot) typedef struct { void *cwd; -} mm_segment_t; +}mm_segment_t; typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); @@ -231,16 +181,6 @@ static __inline__ int test_bit(int nr, long * addr) return ((mask & *addr) != 0); } -static __inline__ int test_and_set_bit(int nr, long * addr) -{ - int res; - - res = test_bit(nr, addr); - set_bit(nr, addr); - - return res; -} - static __inline__ int ext2_set_bit(int nr, void *addr) { return set_bit(nr, (long*)addr); @@ -592,78 +532,6 @@ struct semaphore { int count; }; -struct crypto_tfm; - -struct scatterlist { - struct page *page; - unsigned int offset; - __u32 dma_address; - unsigned int length; -}; - -struct cipher_tfm { - void *cit_iv; - unsigned int cit_ivsize; - __u32 cit_mode; - int (*cit_setkey)(struct crypto_tfm *tfm, - const __u8 *key, unsigned int keylen); - int (*cit_encrypt)(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes); - int (*cit_encrypt_iv)(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, __u8 *iv); - int (*cit_decrypt)(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes); - int (*cit_decrypt_iv)(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, __u8 *iv); - void (*cit_xor_block)(__u8 *dst, const __u8 *src); -}; - -struct digest_tfm { - void (*dit_init)(struct crypto_tfm *tfm); - void (*dit_update)(struct crypto_tfm *tfm, - struct scatterlist *sg, unsigned int nsg); - void (*dit_update_kernel)(struct crypto_tfm *tfm, - const void *data, size_t count); - void (*dit_final)(struct crypto_tfm *tfm, __u8 *out); - void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, - unsigned int nsg, __u8 *out); - int (*dit_setkey)(struct crypto_tfm *tfm, - const __u8 *key, unsigned int keylen); -#ifdef CONFIG_CRYPTO_HMAC - void *dit_hmac_block; -#endif -}; - -struct compress_tfm { - int (*cot_compress)(struct crypto_tfm *tfm, - const __u8 *src, unsigned int slen, - __u8 *dst, unsigned int *dlen); - int (*cot_decompress)(struct crypto_tfm *tfm, - const __u8 *src, unsigned int slen, - __u8 *dst, unsigned int *dlen); -}; - -struct crypto_tfm { - - __u32 crt_flags; - - union { - struct cipher_tfm cipher; - struct digest_tfm digest; - struct compress_tfm compress; - } crt_u; - - struct crypto_alg *__crt_alg; -}; - /* use the macro's argument to avoid unused warnings */ #define down(a) do { (void)a; } while (0) #define up(a) do { (void)a; } while (0) @@ -673,25 +541,16 @@ struct crypto_tfm { #define up_write(a) do { (void)a; } while (0) #define sema_init(a,b) do { (void)a; } while (0) #define init_rwsem(a) do { (void)a; } while (0) - #define DECLARE_MUTEX(name) \ struct semaphore name = { 1 } - static inline void init_MUTEX (struct semaphore *sem) { sema_init(sem, 1); } -struct rpc_pipe_msg { - struct list_head list; - void *data; - size_t len; - size_t copied; - int error; -}; typedef struct { - struct list_head task_list; + struct list_head sleepers; } wait_queue_head_t; typedef struct { @@ -721,7 +580,6 @@ struct task_struct { int ngroups; gid_t *groups; __u32 cap_effective; - __u32 pag; struct fs_struct __fs; }; @@ -739,15 +597,15 @@ static inline int capable(int cap) #define set_current_state(foo) do { current->state = foo; } while (0) #define init_waitqueue_entry(q,p) do { (q)->process = p; } while (0) -#define add_wait_queue(q,p) do { list_add(&(q)->task_list, &(p)->sleeping); } while (0) +#define add_wait_queue(q,p) do { list_add(&(q)->sleepers, &(p)->sleeping); } while (0) #define del_wait_queue(p) do { list_del(&(p)->sleeping); } while (0) #define remove_wait_queue(q,p) do { list_del(&(p)->sleeping); } while (0) #define DECLARE_WAIT_QUEUE_HEAD(HEAD) \ wait_queue_head_t HEAD = { \ - .task_list = LIST_HEAD_INIT(HEAD.task_list) \ + .sleepers = LIST_HEAD_INIT(HEAD.sleepers) \ } -#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->task_list) +#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->sleepers) #define wake_up(l) do { int a; a++; } while (0) #define TASK_INTERRUPTIBLE 0 #define TASK_UNINTERRUPTIBLE 1 @@ -844,7 +702,6 @@ typedef struct { volatile int counter; } atomic_t; #define atomic_read(a) ((a)->counter) #define atomic_set(a,b) do {(a)->counter = b; } while (0) #define atomic_dec_and_test(a) ((--((a)->counter)) == 0) -#define atomic_dec_and_lock(a, l) atomic_dec_and_test(a) #define atomic_inc(a) (((a)->counter)++) #define atomic_dec(a) do { (a)->counter--; } while (0) #define atomic_add(b,a) do {(a)->counter += b;} while (0) @@ -892,6 +749,14 @@ static inline int llog_cleanup_commit_master(int force) { return 0; } static inline void portals_run_lbug_upcall(char *file, const char *fn, const int l){} +#define LBUG() \ + do { \ + printf("!!!LBUG at %s:%d\n", __FILE__, __LINE__); \ + sleep(1000000); \ + } while (0) + + + /* completion */ struct completion { unsigned int done; diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index b78582f..2ee7cd0 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -1288,6 +1288,7 @@ typedef enum { GKS_GET_MAC = 704, } gks_cmd_t; +#ifdef __KERNEL__ #define KEY_SIZE 16 #define MAC_SIZE 16 @@ -1297,14 +1298,6 @@ struct crypto_key { __u32 ck_type; }; -#ifndef __KERNEL__ -struct posix_acl_entry { - short e_tag; - unsigned short e_perm; - unsigned int e_id; -}; -#endif - struct key_perm { uid_t kp_uid; gid_t kp_gid; @@ -1319,11 +1312,11 @@ struct key_context { __u32 kc_valid; struct key_perm kc_perm; }; -typedef int (*crypt_cb_t)(struct page *page, __u64 offset, - __u64 count, int flags); - +typedef int (*crypt_cb_t)(struct page *page, __u64 offset, __u64 count, + int flags); extern void lustre_swab_key_context (struct key_context *kctxt); extern void lustre_swab_key_perms (struct key_perm *kperm); +#endif /*for define __KERNEL*/ extern void lustre_swab_lustre_id(struct lustre_id *id); extern void lustre_swab_lov_desc(struct lov_desc *desc); diff --git a/lustre/include/linux/lustre_sec.h b/lustre/include/linux/lustre_sec.h index cafae26..22bcffa 100644 --- a/lustre/include/linux/lustre_sec.h +++ b/lustre/include/linux/lustre_sec.h @@ -128,6 +128,8 @@ __u32 ptlrpcs_name2flavor(const char *name); char *ptlrpcs_flavor2name(__u32 flavor); +#ifdef __KERNEL__ + /* forward declaration */ struct obd_import; struct ptlrpc_request; @@ -136,6 +138,7 @@ struct ptlrpc_credops; struct ptlrpc_sec; struct ptlrpc_secops; + typedef struct { struct list_head list; __u32 flavor; @@ -503,9 +506,7 @@ int svcsec_null_init(void); int svcsec_null_exit(void); /* capability */ -#ifdef __KERNEL__ #include -#endif #define NR_CAPAHASH 32 #define CAPA_TIMEOUT 1800 /* sec, == 30 min */ @@ -577,7 +578,7 @@ struct obd_capa *capa_get(uid_t uid, int capa_op, __u64 mdsid, struct lustre_handle *handle); void capa_put(struct obd_capa *ocapa, int type); int capa_renew(struct lustre_capa *capa, int type); -void capa_hmac(struct crypto_tfm *tfm, __u8 *key, struct lustre_capa *capa); +void capa_hmac(struct crypto_tfm *tfm, u8 *key, struct lustre_capa *capa); void capa_dup(void *dst, struct obd_capa *ocapa); void capa_dup2(void *dst, struct lustre_capa *capa); int capa_expired(struct lustre_capa *capa); @@ -631,6 +632,8 @@ expiry_to_jiffies(__u64 expiry) return jiffies + ((unsigned long)expiry - tv.tv_sec) * HZ; } +#endif /* __KERNEL__ */ + struct mds_capa_key { struct list_head k_list; @@ -640,6 +643,7 @@ struct mds_capa_key { struct filter_capa_key { struct list_head k_list; + struct lustre_capa_key k_key; }; diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h index 0fc302f..4c3c8e1 100644 --- a/lustre/include/linux/lvfs.h +++ b/lustre/include/linux/lvfs.h @@ -35,8 +35,10 @@ #include #include #include -#else -#include +#endif + +#ifdef LIBLUSTRE +#include #endif struct mds_grp_hash_entry; diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index 1563798..b2fa8f4 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -408,9 +408,8 @@ static void llu_truncate(struct inode *inode) oa.o_id, lli->lli_st_size); /* truncate == punch from new size to absolute end of file */ - /* XXX: capa is NULL here, is it correct? */ err = obd_punch(llu_i2dtexp(inode), &oa, lsm, lli->lli_st_size, - OBD_OBJECT_EOF, NULL, NULL); + OBD_OBJECT_EOF, NULL); if (err) CERROR("obd_truncate fails (%d) ino %lu\n", err, lli->lli_st_ino); else diff --git a/lustre/liblustre/genlib.sh b/lustre/liblustre/genlib.sh index c60cd66..f5c489e 100755 --- a/lustre/liblustre/genlib.sh +++ b/lustre/liblustre/genlib.sh @@ -53,7 +53,7 @@ build_sysio_obj_list() { _objs=`$AR -t $1` mkdir -p $sysio_tmp cd $sysio_tmp - $AR -x $1 + $AR -x ../$1 cd .. for _lib in $_objs; do ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib "; diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c index d1528e6..c4b00a5 100644 --- a/lustre/liblustre/llite_lib.c +++ b/lustre/liblustre/llite_lib.c @@ -124,16 +124,16 @@ int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov) lcfg = lustre_cfg_new(LCFG_ADD_UUID, &bufs); lcfg->lcfg_nid = nid; lcfg->lcfg_nal = nal; - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err < 0) GOTO(out, err); lustre_cfg_bufs_reset(&bufs, name); - lustre_cfg_bufs_set_string(&bufs, 1, OBD_MDC_DEVICENAME); + lustre_cfg_bufs_set_string(&bufs, 1, LUSTRE_MDC_NAME); lustre_cfg_bufs_set_string(&bufs, 2, mdc_uuid.uuid); lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs); - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err < 0) GOTO(out_del_uuid, err); @@ -142,7 +142,7 @@ int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov) lustre_cfg_bufs_set_string(&bufs, 1, g_zconf_mdsname); lustre_cfg_bufs_set_string(&bufs, 2, peer); lcfg = lustre_cfg_new(LCFG_SETUP, &bufs); - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err < 0) GOTO(out_detach, err); @@ -175,7 +175,7 @@ int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov) out_cleanup: lustre_cfg_bufs_reset(&bufs, name); lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs); - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err < 0) GOTO(out, err); @@ -183,7 +183,7 @@ out_cleanup: out_detach: lustre_cfg_bufs_reset(&bufs, name); lcfg = lustre_cfg_new(LCFG_DETACH, &bufs); - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err < 0) GOTO(out, err); diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 02abb60..92d9444 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -385,8 +385,7 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset, struct inode *llu_inode_from_lock(struct ldlm_lock *lock) { struct inode *inode; -#warning "fix l_lock() using here!" -// l_lock(&lock->l_resource->lr_namespace->ns_lock); + l_lock(&lock->l_resource->lr_namespace->ns_lock); if (lock->l_ast_data) { inode = (struct inode *)lock->l_ast_data; @@ -394,7 +393,7 @@ struct inode *llu_inode_from_lock(struct ldlm_lock *lock) } else inode = NULL; -// l_unlock(&lock->l_resource->lr_namespace->ns_lock); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); return inode; } diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index 543be8a..c6f4bd0 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -147,11 +147,10 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock, lsm = lli->lli_smd; stripe = llu_lock_to_stripe_offset(inode, lock); -#warning "fix l_lock() using here!" -// l_lock(&lock->l_resource->lr_namespace->ns_lock); + l_lock(&lock->l_resource->lr_namespace->ns_lock); kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); -// l_unlock(&lock->l_resource->lr_namespace->ns_lock); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 3ac318b..111f038 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -106,13 +106,13 @@ static void llu_fsop_gone(struct filesys *fs) lustre_cfg_bufs_reset(&bufs, obd->obd_name); lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs); - err = class_process_config(lcfg); + err = class_process_config(&lcfg); if (err) { CERROR("cleanup failed: %s\n", obd->obd_name); } lcfg->lcfg_command = LCFG_DETACH; - err = class_process_config(lcfg); + err = class_process_config(&lcfg); lustre_cfg_free(lcfg); if (err) { CERROR("detach failed: %s\n", obd->obd_name); @@ -346,11 +346,10 @@ int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm) RETURN(0); } -static struct inode *llu_new_inode(struct filesys *fs, +static struct inode* llu_new_inode(struct filesys *fs, struct lustre_id *id) { struct inode *inode; - struct intnl_stat stat; struct llu_inode_info *lli; OBD_ALLOC(lli, sizeof(*lli)); @@ -370,13 +369,15 @@ static struct inode *llu_new_inode(struct filesys *fs, memcpy(&lli->lli_id, id, sizeof(*id)); -#warning "fill @stat by desired attributes of new inode before using_sysio_i_new()" - memset(&stat, 0, sizeof(stat)); - stat.st_ino = id_ino(id); - /* file identifier is needed by functions like _sysio_i_find() */ inode = _sysio_i_new(fs, &lli->lli_sysio_fid, - &stat, 0, &llu_inode_ops, lli); +#ifndef AUTOMOUNT_FILE_NAME + id->li_stc.u.e3s.l3s_type & S_IFMT, +#else + id->li_stc.u.e3s.l3s_type, /* all of the bits! */ +#endif + 0, 0, + &llu_inode_ops, lli); if (!inode) OBD_FREE(lli, sizeof(*lli)); @@ -445,10 +446,8 @@ static int llu_inode_revalidate(struct inode *inode) valid |= OBD_MD_FLEASIZE; } ll_inode2id(&id, inode); - - /* XXX: capa is NULL here, is it correct? */ - rc = mdc_getattr(sbi->ll_md_exp, &id, valid, NULL, NULL, - 0, ealen, NULL, &req); + rc = mdc_getattr(sbi->ll_md_exp, &id, valid, NULL, 0, + NULL, ealen, &req); if (rc) { CERROR("failure %d inode %lu\n", rc, lli->lli_st_ino); RETURN(-abs(rc)); @@ -490,9 +489,10 @@ static int llu_inode_revalidate(struct inode *inode) RETURN(llu_glimpse_size(inode)); } -static void copy_stat_buf_lli(struct llu_inode_info *lli, - struct intnl_stat *b) +static void copy_stat_buf(struct inode *ino, struct intnl_stat *b) { + struct llu_inode_info *lli = llu_i2info(ino); + b->st_dev = lli->lli_st_dev; b->st_ino = lli->lli_st_ino; b->st_mode = lli->lli_st_mode; @@ -508,12 +508,6 @@ static void copy_stat_buf_lli(struct llu_inode_info *lli, b->st_ctime = lli->lli_st_ctime; } -static void copy_stat_buf(struct inode *ino, struct intnl_stat *b) -{ - struct llu_inode_info *lli = llu_i2info(ino); - copy_stat_buf_lli(lli, b); -} - static int llu_iop_getattr(struct pnode *pno, struct inode *ino, struct intnl_stat *b) @@ -696,7 +690,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) llu_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0); rc = mdc_setattr(sbi->ll_md_exp, &op_data, - attr, NULL, 0, NULL, 0, NULL, 0, &request); + attr, NULL, 0, NULL, 0, &request); if (rc) { ptlrpc_req_finished(request); @@ -883,10 +877,8 @@ static int llu_readlink_internal(struct inode *inode, } ll_inode2id(&id, inode); - - /* XXX: capa is NULL here, is it correct? */ - rc = mdc_getattr(sbi->ll_md_exp, &id, OBD_MD_LINKNAME, NULL, 0, - 0, symlen, NULL, request); + rc = mdc_getattr(sbi->ll_md_exp, &id, + OBD_MD_LINKNAME, NULL, 0, NULL, symlen, request); if (rc) { CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc); RETURN(rc); @@ -1538,10 +1530,10 @@ llu_fsswop_mount(const char *source, CDEBUG(D_SUPER, "rootid "LPU64"\n", rootid.li_stc.u.e3s.l3s_ino); sbi->ll_rootino = rootid.li_stc.u.e3s.l3s_ino; - /* XXX: capa is NULL here, is it correct? */ + /* fetch attr of root inode */ err = mdc_getattr(sbi->ll_md_exp, &rootid, - (OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS), NULL, 0, - 0, 0, NULL, &request); + OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, NULL, 0, + NULL, 0, &request); if (err) { CERROR("mdc_getattr failed for root: rc = %d\n", err); GOTO(out_lov, err); diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c index 4bebb59..40ae02a 100644 --- a/lustre/llite/llite_capa.c +++ b/lustre/llite/llite_capa.c @@ -196,7 +196,7 @@ void ll_capa_stop_thread(void) } int ll_set_och_capa(struct inode *inode, struct lookup_intent *it, - struct obd_client_handle *och) + struct obd_client_handle *och) { struct ptlrpc_request *req = LUSTRE_IT(it)->it_data; struct ll_inode_info *lli = ll_i2info(inode); diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index 18d4311..8d2cb21 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -28,7 +28,6 @@ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -40,12 +39,7 @@ #include #include #include -#else -#include -#endif - #include -#include kmem_cache_t *capa_cachep = NULL; @@ -153,19 +147,20 @@ static void destroy_capa(struct obd_capa *ocapa) int capa_cache_init(void) { - int nr_hash, i; + int order = 0, nr_hash, i; - OBD_ALLOC(capa_hash, PAGE_SIZE); + capa_hash = (struct hlist_head *) + __get_free_pages(GFP_ATOMIC, order); if (!capa_hash) - return -ENOMEM; + panic("Cannot create capa_hash hash table"); - nr_hash = PAGE_SIZE / sizeof(struct hlist_head); + nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head); LASSERT(nr_hash > NR_CAPAHASH); for (i = 0; i < NR_CAPAHASH; i++) INIT_HLIST_HEAD(capa_hash + i); - for (i = 0; i < 3; i++) + for (i =0; i < 3; i++) INIT_LIST_HEAD(&capa_list[i]); return 0; @@ -229,9 +224,7 @@ get_new_capa_locked(struct hlist_head *head, uid_t uid, int capa_op,__u64 mdsid, ocapa->c_type = type; if (type == CLIENT_CAPA) { LASSERT(inode); -#ifdef __KERNEL__ igrab(inode); -#endif ocapa->c_inode = inode; memcpy(&ocapa->c_handle, handle, sizeof(*handle)); } @@ -311,9 +304,7 @@ void capa_put(struct obd_capa *ocapa, int type) if (ocapa) { if (atomic_dec_and_lock(&ocapa->c_refc, &capa_lock)) { if (type == CLIENT_CAPA) { -#ifdef __KERNEL__ iput(ocapa->c_inode); -#endif __capa_put(ocapa, type); destroy_capa(ocapa); } @@ -358,7 +349,7 @@ int capa_renew(struct lustre_capa *capa, int type) return update_capa_locked(capa, type); } -void capa_hmac(struct crypto_tfm *tfm, __u8 *key, struct lustre_capa *capa) +void capa_hmac(struct crypto_tfm *tfm, u8 *key, struct lustre_capa *capa) { int keylen = CAPA_KEY_LEN; struct scatterlist sl = { diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 00aeb83..aeae7d0 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -778,8 +778,8 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa, struct client_obd *cli = &imp->imp_obd->u.cli; struct ost_body *body; struct lustre_id *raw_id = obdo_id(oa); - struct obd_capa *ocapa = NULL; - struct lustre_capa *capa = NULL; + struct obd_capa *ocapa; + struct lustre_capa *capa; struct obd_ioobj *ioobj; struct niobuf_remote *niobuf; int niocount; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 5fc436a..f319244 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -36,6 +36,8 @@ #include #include #include +#include + #define HDR_SIZE(count) \ size_round(offsetof (struct lustre_msg, buflens[(count)])) @@ -964,7 +966,6 @@ int llog_log_swabbed(struct llog_log_hdr *hdr) void lustre_assert_wire_constants(void) { } - /* for gks key rec */ void lustre_swab_key_perms(struct key_perm *kperm) { @@ -979,10 +980,9 @@ void lustre_swab_key_perms(struct key_perm *kperm) __swab32s(&kperm->kp_acls[i].e_id); } } - void lustre_swab_key_context (struct key_context *kctxt) { - __swab32s(&kctxt->kc_command); - __swab32s(&kctxt->kc_valid); /* for use with open */ + __swab32s (&kctxt->kc_command); + __swab32s (&kctxt->kc_valid); /* for use with open */ lustre_swab_key_perms(&kctxt->kc_perm); } diff --git a/lustre/sec/gss/gss_internal.h b/lustre/sec/gss/gss_internal.h index d1e0521..eadb6e4 100644 --- a/lustre/sec/gss/gss_internal.h +++ b/lustre/sec/gss/gss_internal.h @@ -46,6 +46,13 @@ #define CRYPTO_UNSPEC 0 #define CRYPTO_MAX_ALG_NAME 64 +struct scatterlist { + struct page *page; + unsigned int offset; + __u32 dma_address; + unsigned int length; +}; + static inline struct crypto_tfm * crypto_alloc_tfm(const char *name, __u32 flags) { diff --git a/lustre/sec/gss/sec_gss.c b/lustre/sec/gss/sec_gss.c index b11872f..a2e6a83 100644 --- a/lustre/sec/gss/sec_gss.c +++ b/lustre/sec/gss/sec_gss.c @@ -384,12 +384,18 @@ out_copy: struct gss_sec { struct ptlrpc_sec gs_base; struct gss_api_mech *gs_mech; +#ifdef __KERNEL__ spinlock_t gs_lock; struct list_head gs_upcalls; char *gs_pipepath; struct dentry *gs_depipe; +#endif }; +#ifdef __KERNEL__ + +static rwlock_t gss_ctx_lock = RW_LOCK_UNLOCKED; + struct gss_upcall_msg_data { __u64 gum_pag; __u32 gum_uid; @@ -409,8 +415,6 @@ struct gss_upcall_msg { struct gss_upcall_msg_data gum_data; }; -#ifdef __KERNEL__ -static rwlock_t gss_ctx_lock = RW_LOCK_UNLOCKED; /********************************************** * rpc_pipe upcall helpers * **********************************************/ @@ -432,11 +436,10 @@ void gss_release_msg(struct gss_upcall_msg *gmsg) #else /* XXX */ if (!list_empty(&gmsg->gum_base.list)) { - int error = gmsg->gum_base.errno; - CWARN("msg %p: list: %p/%p/%p, copied %d, err %d, wq %d\n", - gmsg, &gmsg->gum_base.list, gmsg->gum_base.list.prev, - gmsg->gum_base.list.next, gmsg->gum_base.copied, error, + gmsg, &gmsg->gum_base.list, + gmsg->gum_base.list.prev, gmsg->gum_base.list.next, + gmsg->gum_base.copied, gmsg->gum_base.errno, list_empty(&gmsg->gum_waitq.task_list)); LBUG(); } @@ -519,11 +522,10 @@ static void gss_init_upcall_msg(struct gss_upcall_msg *gmsg, } #endif /* __KERNEL__ */ -/* this seems to be used only from userspace code */ -#ifndef __KERNEL__ /******************************************** * gss cred manipulation helpers * ********************************************/ +#if 0 static int gss_cred_is_uptodate_ctx(struct ptlrpc_cred *cred) { @@ -541,7 +543,7 @@ int gss_cred_is_uptodate_ctx(struct ptlrpc_cred *cred) #endif static inline -struct gss_cl_ctx *gss_get_ctx(struct gss_cl_ctx *ctx) +struct gss_cl_ctx * gss_get_ctx(struct gss_cl_ctx *ctx) { atomic_inc(&ctx->gc_refcount); return ctx; @@ -878,7 +880,8 @@ out: } #else /* !__KERNEL__ */ extern int lgss_handle_krb5_upcall(uid_t uid, __u32 dest_ip, - char *obd_name, char *buf, int bufsize, + char *obd_name, + char *buf, int bufsize, int (*callback)(char*, unsigned long)); static int gss_cred_refresh(struct ptlrpc_cred *cred) @@ -889,11 +892,11 @@ static int gss_cred_refresh(struct ptlrpc_cred *cred) struct gss_sec *gsec; struct gss_api_mech *mech; struct gss_cl_ctx *ctx = NULL; + struct vfs_cred vcred = { 0 }; ptl_nid_t peer_nid; __u32 dest_ip; __u32 subflavor; int rc, gss_err; - struct gss_upcall_msg_data gmd = { 0 }; LASSERT(cred); LASSERT(cred->pc_sec); @@ -906,9 +909,9 @@ static int gss_cred_refresh(struct ptlrpc_cred *cred) imp = cred->pc_sec->ps_import; peer_nid = imp->imp_connection->c_peer.peer_id.nid; dest_ip = (__u32) (peer_nid & 0xFFFFFFFF); - subflavor = cred->pc_sec->ps_flavor; + subflavor = cred->pc_sec->ps_flavor.subflavor; - if (subflavor != PTLRPCS_SUBFLVR_KRB5I) { + if (subflavor != PTLRPC_SEC_GSS_KRB5I) { CERROR("unknown subflavor %u\n", subflavor); GOTO(err_out, rc = -EINVAL); } @@ -927,8 +930,7 @@ static int gss_cred_refresh(struct ptlrpc_cred *cred) gsec = container_of(cred->pc_sec, struct gss_sec, gs_base); mech = gsec->gs_mech; LASSERT(mech); - - rc = gss_parse_init_downcall(mech, &obj, &ctx, &gmd, + rc = gss_parse_init_downcall(mech, &obj, &ctx, &vcred, &dest_ip, &gss_err); if (rc || gss_err) { CERROR("parse init downcall: rpc %d, gss 0x%x\n", rc, gss_err); @@ -1669,11 +1671,10 @@ struct ptlrpc_sec* gss_create_sec(__u32 flavor, { struct gss_sec *gsec; struct ptlrpc_sec *sec; - uid_t save_uid; - #ifdef __KERNEL__ char *pos; int pipepath_len; + uid_t save_uid; #endif ENTRY; diff --git a/lustre/sec/sec.c b/lustre/sec/sec.c index a9f4e56..b2e8b64 100644 --- a/lustre/sec/sec.c +++ b/lustre/sec/sec.c @@ -1112,13 +1112,12 @@ int __init ptlrpc_sec_init(void) return 0; } -#if defined __KERNEL__ && defined ENABLE_GSS static void __exit ptlrpc_sec_exit(void) { svcsec_null_exit(); ptlrpcs_null_exit(); } -#endif + EXPORT_SYMBOL(ptlrpcs_register); EXPORT_SYMBOL(ptlrpcs_unregister); diff --git a/lustre/tests/test45.sh b/lustre/tests/test45.sh index 0662f8e..ef1f6f7 100644 --- a/lustre/tests/test45.sh +++ b/lustre/tests/test45.sh @@ -78,9 +78,8 @@ ${LMC} -m $config --add filesystem --filesystem $FS_NODE2 || exit 1 ${LMC} -m $config --add filesystem --filesystem $FS_MASTER || exit 1 # node 1 -${LMC} -m $config --add net --node client --nid "*" --nettype $NETTYPE || exit 1 - ${LMC} -m $config --add node --node $NODE1 || exit 1 + ${LMC} -m $config --add net --node $NODE1 --nid `h2$NIDTYPE $NODE1` \ --nettype $NETTYPE || exit 1 @@ -120,6 +119,7 @@ ${LMC} -m $config --add cmobd --node $NODE1 --cmobd $CMOBD_OST1 \ # node 2 ${LMC} -m $config --add node --node $NODE2 || exit 1 + ${LMC} -m $config --add net --node $NODE2 --nid `h2$NIDTYPE $NODE2` \ --nettype $NETTYPE || exit 1 diff --git a/lustre/utils/lconf b/lustre/utils/lconf index b4ff31c..bbc5787 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -2963,9 +2963,6 @@ class Mountpoint(Module): cmd = "mount -t lustre_lite -o osc=%s,mdc=%s,gkc=%s,mds_sec=%s,oss_sec=%s%s %s %s" % \ (self.vosc.get_name(), self.vmdc.get_name(), gkc_name, self.mds_sec, self.oss_sec, self.clientoptions, config.config, self.path) - log("mount -t lustre_lite -o osc=%s,mdc=%s,gkc=%s,mds_sec=%s,oss_sec=%s%s %s %s" % \ - (self.vosc.get_name(), self.vmdc.get_name(), gkc_name, self.mds_sec, - self.oss_sec, self.clientoptions, config.config, self.path)) run("mkdir", self.path) ret, val = run(cmd) if ret: diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index f13072a..bcba4ae 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -32,9 +32,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -55,6 +55,7 @@ #include #include #include + #include static void err_msg(char *fmt, ...)