Whamcloud - gitweb
- fixes for making liblustre at least buildable (including fixes to compilation bug...
authoryury <yury>
Thu, 11 Aug 2005 11:55:33 +0000 (11:55 +0000)
committeryury <yury>
Thu, 11 Aug 2005 11:55:33 +0000 (11:55 +0000)
21 files changed:
lustre/include/liblustre.h
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_sec.h
lustre/include/linux/lvfs.h
lustre/liblustre/file.c
lustre/liblustre/genlib.sh
lustre/liblustre/llite_lib.c
lustre/liblustre/namei.c
lustre/liblustre/rw.c
lustre/liblustre/super.c
lustre/llite/llite_capa.c
lustre/lvfs/lvfs_userfs.c
lustre/obdclass/capa.c
lustre/osc/osc_request.c
lustre/ptlrpc/pack_generic.c
lustre/sec/gss/gss_internal.h
lustre/sec/gss/sec_gss.c
lustre/sec/sec.c
lustre/tests/test45.sh
lustre/utils/lconf
lustre/utils/liblustreapi.c

index 56ed008..c5446ff 100644 (file)
@@ -70,6 +70,56 @@ 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)
@@ -122,7 +172,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);
@@ -181,6 +231,16 @@ 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);
@@ -532,6 +592,78 @@ 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)
@@ -541,16 +673,25 @@ struct semaphore {
 #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 sleepers;
+        struct list_head task_list;
 } wait_queue_head_t;
 
 typedef struct  {
@@ -580,6 +721,7 @@ struct task_struct {
         int ngroups;
         gid_t *groups;
         __u32 cap_effective;
+        __u32 pag;
 
         struct fs_struct __fs;
 };
@@ -597,15 +739,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)->sleepers, &(p)->sleeping); } while (0)
+#define add_wait_queue(q,p) do {  list_add(&(q)->task_list, &(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 = {                              \
-                .sleepers = LIST_HEAD_INIT(HEAD.sleepers)       \
+                .task_list = LIST_HEAD_INIT(HEAD.task_list)       \
         }
-#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->sleepers)
+#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->task_list)
 #define wake_up(l) do { int a; a++; } while (0)
 #define TASK_INTERRUPTIBLE 0
 #define TASK_UNINTERRUPTIBLE 1
@@ -702,6 +844,7 @@ 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)
@@ -749,14 +892,6 @@ 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;
index 2ee7cd0..b78582f 100644 (file)
@@ -1288,7 +1288,6 @@ typedef enum {
         GKS_GET_MAC      = 704,
 } gks_cmd_t;
 
-#ifdef __KERNEL__
 #define KEY_SIZE        16 
 #define MAC_SIZE        16 
 
@@ -1298,6 +1297,14 @@ 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;
@@ -1312,11 +1319,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);
index 22bcffa..eea64ab 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef __LINUX_SEC_H_
 #define __LINUX_SEC_H_
 
-//#include <linux/lustre_idl.h>
-
 enum ptlrpcs_major_flavors {
         PTLRPCS_FLVR_MAJOR_NULL         = 0,
         PTLRPCS_FLVR_MAJOR_GSS          = 1,
@@ -34,6 +32,7 @@ enum ptlrpcs_null_minor_flavors {
         PTLRPCS_FLVR_MINOR_NULL         = 0,
         PTLRPCS_FLVR_MINOR_NULL_MAX,
 };
+
 enum ptlrpcs_gss_minor_flavors {
         PTLRPCS_FLVR_MINOR_GSS_NONE     = 0,
         PTLRPCS_FLVR_MINOR_GSS_KRB5     = 1,
@@ -128,8 +127,6 @@ __u32 ptlrpcs_name2flavor(const char *name);
 char *ptlrpcs_flavor2name(__u32 flavor);
 
 
-#ifdef __KERNEL__
-
 /* forward declaration */
 struct obd_import;
 struct ptlrpc_request;
@@ -138,7 +135,6 @@ struct ptlrpc_credops;
 struct ptlrpc_sec;
 struct ptlrpc_secops;
 
-
 typedef struct {
         struct list_head        list;
         __u32                   flavor;
@@ -506,7 +502,9 @@ int svcsec_null_init(void);
 int svcsec_null_exit(void);
 
 /* capability */
+#ifdef __KERNEL__
 #include <linux/crypto.h>
+#endif
 
 #define NR_CAPAHASH 32
 #define CAPA_TIMEOUT 1800                /* sec, == 30 min */
@@ -578,7 +576,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);
@@ -632,8 +630,6 @@ 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;
 
@@ -643,7 +639,6 @@ struct mds_capa_key {
 
 struct filter_capa_key {
         struct list_head        k_list;
-
         struct lustre_capa_key  k_key;
 };
 
index 4c3c8e1..0fc302f 100644 (file)
 #include <linux/namei.h>
 #include <linux/lustre_compat25.h>
 #include <linux/lvfs_linux.h>
-#endif
-
-#ifdef LIBLUSTRE
-#include <lvfs_user_fs.h>
+#else
+#include <liblustre.h>
 #endif
 
 struct mds_grp_hash_entry;
index b2fa8f4..1563798 100644 (file)
@@ -408,8 +408,9 @@ 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);
+                        OBD_OBJECT_EOF, NULL, NULL);
         if (err)
                 CERROR("obd_truncate fails (%d) ino %lu\n", err, lli->lli_st_ino);
         else
index f5c489e..c60cd66 100755 (executable)
@@ -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 ";
index c4b00a5..d1528e6 100644 (file)
@@ -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, LUSTRE_MDC_NAME);
+        lustre_cfg_bufs_set_string(&bufs, 1, OBD_MDC_DEVICENAME);
         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);
index 92d9444..02abb60 100644 (file)
@@ -385,7 +385,8 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
 struct inode *llu_inode_from_lock(struct ldlm_lock *lock)
 {
         struct inode *inode;
-        l_lock(&lock->l_resource->lr_namespace->ns_lock);
+#warning "fix l_lock() using here!"
+//        l_lock(&lock->l_resource->lr_namespace->ns_lock);
 
         if (lock->l_ast_data) {
                 inode = (struct inode *)lock->l_ast_data;
@@ -393,7 +394,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;
 }
 
index c6f4bd0..543be8a 100644 (file)
@@ -147,10 +147,11 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock,
                 lsm = lli->lli_smd;
 
                 stripe = llu_lock_to_stripe_offset(inode, lock);
-                l_lock(&lock->l_resource->lr_namespace->ns_lock);
+#warning "fix l_lock() using here!"
+//                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);
index 111f038..3ac318b 100644 (file)
@@ -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,10 +346,11 @@ int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm)
         RETURN(0);
 }
 
-static struct inodellu_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));
@@ -369,15 +370,13 @@ 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,
-#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);
+                             &stat, 0, &llu_inode_ops, lli);
 
        if (!inode)
                OBD_FREE(lli, sizeof(*lli));
@@ -446,8 +445,10 @@ static int llu_inode_revalidate(struct inode *inode)
                         valid |= OBD_MD_FLEASIZE;
                 }
                 ll_inode2id(&id, inode);
-                rc = mdc_getattr(sbi->ll_md_exp, &id, valid, NULL, 0,
-                                 NULL, ealen, &req);
+
+                /* XXX: capa is NULL here, is it correct? */
+                rc = mdc_getattr(sbi->ll_md_exp, &id, valid, NULL, NULL,
+                                 0, ealen, NULL, &req);
                 if (rc) {
                         CERROR("failure %d inode %lu\n", rc, lli->lli_st_ino);
                         RETURN(-abs(rc));
@@ -489,10 +490,9 @@ static int llu_inode_revalidate(struct inode *inode)
         RETURN(llu_glimpse_size(inode));
 }
 
-static void copy_stat_buf(struct inode *ino, struct intnl_stat *b)
+static void copy_stat_buf_lli(struct llu_inode_info *lli,
+                              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,6 +508,12 @@ static void copy_stat_buf(struct inode *ino, struct intnl_stat *b)
         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)
@@ -690,7 +696,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, &request);
+                                 attr, NULL, 0, NULL, 0, NULL, 0, &request);
                 
                 if (rc) {
                         ptlrpc_req_finished(request);
@@ -877,8 +883,10 @@ static int llu_readlink_internal(struct inode *inode,
         }
 
         ll_inode2id(&id, inode);
-        rc = mdc_getattr(sbi->ll_md_exp, &id,
-                         OBD_MD_LINKNAME, NULL, 0, NULL, symlen, request);
+
+        /* 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);
         if (rc) {
                 CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc);
                 RETURN(rc);
@@ -1530,10 +1538,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;
 
-        /* fetch attr of root inode */
+        /* XXX: capa is NULL here, is it correct? */
         err = mdc_getattr(sbi->ll_md_exp, &rootid,
-                          OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, NULL, 0,
-                          NULL, 0, &request);
+                          (OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS), NULL, 0,
+                          0, 0, NULL, &request);
         if (err) {
                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
                 GOTO(out_lov, err);
index 40ae02a..4bebb59 100644 (file)
@@ -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);
index bca6e6a..5e39432 100644 (file)
@@ -24,9 +24,8 @@
  */
 
 #include <liblustre.h>
-#include <linux/lvfs.h>
-
 #include <linux/obd.h>
+#include <linux/lvfs.h>
 #include <linux/lustre_lib.h>
 
 /* XXX currently ctxt functions should not be used ?? */
index 8d2cb21..18d4311 100644 (file)
@@ -28,6 +28,7 @@
 
 #define DEBUG_SUBSYSTEM S_SEC
 
+#ifdef __KERNEL__
 #include <linux/version.h>
 #include <linux/fs.h>
 #include <asm/unistd.h>
 #include <linux/lustre_debug.h>
 #include <linux/lustre_idl.h>
 #include <linux/lustre_sec.h>
+#else
+#include <liblustre.h>
+#endif
+
 #include <libcfs/list.h>
+#include <linux/lustre_sec.h>
 
 kmem_cache_t *capa_cachep = NULL;
 
@@ -147,20 +153,19 @@ static void destroy_capa(struct obd_capa *ocapa)
 
 int capa_cache_init(void)
 {
-        int order = 0, nr_hash, i;
+        int nr_hash, i;
 
-        capa_hash = (struct hlist_head *)
-                                __get_free_pages(GFP_ATOMIC, order);
+        OBD_ALLOC(capa_hash, PAGE_SIZE);
         if (!capa_hash)
-                panic("Cannot create capa_hash hash table");
+                return -ENOMEM;
 
-        nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
+        nr_hash = 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;
@@ -224,7 +229,9 @@ 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));
                 }
@@ -304,7 +311,9 @@ 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);
                         }
@@ -349,7 +358,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 = {
index 6c3b4aa..f982ec1 100644 (file)
@@ -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;
-        struct lustre_capa      *capa;
+        struct obd_capa         *ocapa = NULL;
+        struct lustre_capa      *capa = NULL;
         struct obd_ioobj        *ioobj;
         struct niobuf_remote    *niobuf;
         int                      niocount;
index f319244..5fc436a 100644 (file)
@@ -36,8 +36,6 @@
 #include <linux/lustre_sec.h>
 #include <linux/lustre_audit.h>
 #include <linux/fcntl.h>
-#include <linux/posix_acl.h>
-
 
 #define HDR_SIZE(count) \
     size_round(offsetof (struct lustre_msg, buflens[(count)]))
@@ -966,6 +964,7 @@ 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)
 {
@@ -980,9 +979,10 @@ 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);
 }
index eadb6e4..d1e0521 100644 (file)
 #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)
 {
index a2e6a83..b11872f 100644 (file)
@@ -384,18 +384,12 @@ 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;
@@ -415,6 +409,8 @@ 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                    *
  **********************************************/
@@ -436,10 +432,11 @@ 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, gmsg->gum_base.errno,
+                      gmsg, &gmsg->gum_base.list, gmsg->gum_base.list.prev,
+                      gmsg->gum_base.list.next, gmsg->gum_base.copied, error,
                       list_empty(&gmsg->gum_waitq.task_list));
                 LBUG();
         }
@@ -522,10 +519,11 @@ 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)
 {
@@ -543,7 +541,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;
@@ -880,8 +878,7 @@ 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)
@@ -892,11 +889,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);
@@ -909,9 +906,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;
+        subflavor = cred->pc_sec->ps_flavor;
 
-        if (subflavor != PTLRPC_SEC_GSS_KRB5I) {
+        if (subflavor != PTLRPCS_SUBFLVR_KRB5I) {
                 CERROR("unknown subflavor %u\n", subflavor);
                 GOTO(err_out, rc = -EINVAL);
         }
@@ -930,7 +927,8 @@ 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, &vcred, &dest_ip,
+
+        rc = gss_parse_init_downcall(mech, &obj, &ctx, &gmd,
                                      &gss_err);
         if (rc || gss_err) {
                 CERROR("parse init downcall: rpc %d, gss 0x%x\n", rc, gss_err);
@@ -1671,10 +1669,11 @@ 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;
 
index b2e8b64..a9f4e56 100644 (file)
@@ -1112,12 +1112,13 @@ 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);
index ef1f6f7..0662f8e 100644 (file)
@@ -78,8 +78,9 @@ ${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 node --node $NODE1 || exit 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
 
@@ -119,7 +120,6 @@ ${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
 
index bbc5787..b4ff31c 100755 (executable)
@@ -2963,6 +2963,9 @@ 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:
index bcba4ae..f13072a 100644 (file)
@@ -32,9 +32,9 @@
 #include <string.h>
 #include <stddef.h>
 #include <sys/ioctl.h>
+#include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <errno.h>
 #include <dirent.h>
 #include <stdarg.h>
 #include <sys/stat.h>
@@ -55,7 +55,6 @@
 #include <linux/lustre_acl.h>
 #include <lustre/lustre_user.h>
 #include <linux/obd_lov.h>
-
 #include <portals/ptlctl.h>
 
 static void err_msg(char *fmt, ...)