Whamcloud - gitweb
fix handling ost additional.
authorshadow <shadow>
Tue, 9 Dec 2008 08:19:54 +0000 (08:19 +0000)
committershadow <shadow>
Tue, 9 Dec 2008 08:19:54 +0000 (08:19 +0000)
Branch HEAD
b=16492
i=umka

lustre/ChangeLog
lustre/include/lclient.h
lustre/include/lustre_lite.h
lustre/liblustre/Makefile.am
lustre/liblustre/super.c
lustre/llite/Makefile.in
lustre/llite/llite_lib.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_request.c
lustre/tests/conf-sanity.sh

index 5cf43a6..2e343b0 100644 (file)
@@ -13,6 +13,15 @@ tbd  Sun Microsystems, Inc.
         removed cwd "./" (refer to Bugzilla 14399).
        * File join has been disabled in this release, refer to Bugzilla 16929.
 
+Severity   : normal
+Frequency  : rare, need acl's on inode.
+Bugzilla   : 16492
+Description: client can't handle ost additional correctly
+Details    : if ost was added after client connected to mds client can have 
+             hit lnet_try_match_md ... to big messages to wide striped files.
+             in this case need teach client to handle config events about add
+             lov target and update client max ea size at that event.
+
 Severity   : enhancement
 Bugzilla   : 15699
 Description: Changelogs
index dfd7f65..2c88beb 100644 (file)
@@ -371,5 +371,9 @@ int cl_local_size(struct inode *inode);
         ((void)sizeof(env), (void)sizeof(clob), (void)sizeof !!(expr))
 #endif /* !INVARIANT_CHECK */
 
+int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp);
+int cl_ocd_update(struct obd_device *host,
+                  struct obd_device *watched,
+                  enum obd_notify_event ev, void *owner);
 
 #endif /*LCLIENT_H */
index 34bb9f1..9fab984 100644 (file)
@@ -126,45 +126,10 @@ struct lustre_client_ocd {
          */
         __u64      lco_flags;
         spinlock_t lco_lock;
+        struct obd_export *lco_md_exp;
+        struct obd_export *lco_dt_exp;
 };
 
-/**
- * This function is used as an upcall-callback hooked by liblustre and llite
- * clients into obd_notify() listeners chain to handle notifications about
- * change of import connect_flags. See llu_fsswop_mount() and
- * lustre_common_fill_super().
- *
- * Again, it is dumped into this header for the lack of a better place.
- */
-static inline int ll_ocd_update(struct obd_device *host,
-                                struct obd_device *watched,
-                                enum obd_notify_event ev, void *owner)
-{
-        struct lustre_client_ocd *lco;
-        struct client_obd        *cli;
-        __u64 flags;
-        int   result;
-
-        ENTRY;
-        if (!strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
-                cli = &watched->u.cli;
-                lco = owner;
-                flags = cli->cl_import->imp_connect_data.ocd_connect_flags;
-                CDEBUG(D_SUPER, "Changing connect_flags: "LPX64" -> "LPX64"\n",
-                       lco->lco_flags, flags);
-                spin_lock(&lco->lco_lock);
-                lco->lco_flags &= flags;
-                spin_unlock(&lco->lco_lock);
-                result = 0;
-        } else {
-                CERROR("unexpected notification from %s %s!\n",
-                       watched->obd_type->typ_name,
-                       watched->obd_name);
-                result = -EINVAL;
-        }
-        RETURN(result);
-}
-
 /*
  * Chain of hash overflow pages.
  */
index 326a8c0..91e5f01 100644 (file)
@@ -60,7 +60,7 @@ endif
 
 libllite_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \
                     lutil.c lutil.h llite_lib.h llite_cl.c \
-                     ../lclient/lcommon_cl.c ../lclient/glimpse.c
+                     ../lclient/lcommon_cl.c ../lclient/glimpse.c ../lclient/lcommon_misc.c
 
 # for make rpms -- need cleanup
 liblustre_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \
index ff23356..a410d2f 100644 (file)
@@ -1923,39 +1923,6 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
 }
 
 static int
-llu_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
-{
-        /* even if default lov is LOV_MAGIC_V1 we use LOV_MAGIC_V3
-         * to be sure buffer are large enough */
-        struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 };
-        __u32 valsize = sizeof(struct lov_desc);
-        int rc, easize, def_easize, cookiesize;
-        struct lov_desc desc;
-        __u32 stripes;
-        ENTRY;
-
-        rc = obd_get_info(dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
-                          &valsize, &desc, NULL);
-        if (rc)
-                RETURN(rc);
-
-        stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
-        lsm.lsm_stripe_count = stripes;
-        easize = obd_size_diskmd(dt_exp, &lsm);
-
-        lsm.lsm_stripe_count = desc.ld_default_stripe_count;
-        def_easize = obd_size_diskmd(dt_exp, &lsm);
-
-        cookiesize = stripes * sizeof(struct llog_cookie);
-
-        CDEBUG(D_HA, "updating max_mdsize/max_cookiesize: %d/%d\n",
-               easize, cookiesize);
-
-        rc = md_init_ea_size(md_exp, easize, def_easize, cookiesize);
-        RETURN(rc);
-}
-
-static int
 llu_fsswop_mount(const char *source,
                  unsigned flags,
                  const void *data __IS_UNUSED,
@@ -2084,7 +2051,7 @@ llu_fsswop_mount(const char *source,
                            sizeof(async), &async, NULL);
 
         obd->obd_upcall.onu_owner = &sbi->ll_lco;
-        obd->obd_upcall.onu_upcall = ll_ocd_update;
+        obd->obd_upcall.onu_upcall = cl_ocd_update;
 
         ocd.ocd_connect_flags = OBD_CONNECT_SRVLOCK | OBD_CONNECT_REQPORTAL |
                                 OBD_CONNECT_VERSION | OBD_CONNECT_TRUNCLOCK |
@@ -2097,13 +2064,8 @@ llu_fsswop_mount(const char *source,
         }
         sbi->ll_dt_exp = class_conn2export(&dt_conn);
         sbi->ll_lco.lco_flags = ocd.ocd_connect_flags;
-
-        if (err) {
-                CERROR("cannot register lock cancel callback: rc = %d\n", err);
-                GOTO(out_dt, err);
-        }
-
-        llu_init_ea_size(sbi->ll_md_exp, sbi->ll_dt_exp);
+        sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
+        sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
 
         fid_zero(&sbi->ll_root_fid);
         err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, NULL);
@@ -2169,7 +2131,6 @@ out_inode:
 out_request:
         ptlrpc_req_finished(request);
 out_lock_cn_cb:
-out_dt:
         obd_disconnect(sbi->ll_dt_exp);
 out_md:
         obd_disconnect(sbi->ll_md_exp);
index b06f901..848c26b 100644 (file)
@@ -3,7 +3,7 @@ lustre-objs := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o
 lustre-objs += llite_fid.o rw.o lproc_llite.o namei.o symlink.o llite_mmap.o
 lustre-objs += xattr.o remote_perm.o llite_rmtacl.o llite_capa.o
 lustre-objs += rw26.o super25.o statahead.o
-lustre-objs += ../lclient/glimpse.o ../lclient/lcommon_cl.o
+lustre-objs += ../lclient/glimpse.o ../lclient/lcommon_cl.o ../lclient/lcommon_misc.o
 lustre-objs += vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o
 
 llite_lloop-objs := lloop.o
index 6b99d14..7532fa8 100644 (file)
@@ -158,40 +158,6 @@ static struct dentry_operations ll_d_root_ops = {
 #endif
 };
 
-/* Initialize the default and maximum LOV EA and cookie sizes.  This allows
- * us to make MDS RPCs with large enough reply buffers to hold the
- * maximum-sized (= maximum striped) EA and cookie without having to
- * calculate this (via a call into the LOV + OSCs) each time we make an RPC. */
-static int ll_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
-{
-        struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 };
-        __u32 valsize = sizeof(struct lov_desc);
-        int rc, easize, def_easize, cookiesize;
-        struct lov_desc desc;
-        __u32 stripes;
-        ENTRY;
-
-        rc = obd_get_info(dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
-                          &valsize, &desc, NULL);
-        if (rc)
-                RETURN(rc);
-
-        stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
-        lsm.lsm_stripe_count = stripes;
-        easize = obd_size_diskmd(dt_exp, &lsm);
-
-        lsm.lsm_stripe_count = desc.ld_default_stripe_count;
-        def_easize = obd_size_diskmd(dt_exp, &lsm);
-
-        cookiesize = stripes * sizeof(struct llog_cookie);
-
-        CDEBUG(D_HA, "updating max_mdsize/max_cookiesize: %d/%d\n",
-               easize, cookiesize);
-
-        rc = md_init_ea_size(md_exp, easize, def_easize, cookiesize);
-        RETURN(rc);
-}
-
 static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 {
         struct inode *root = 0;
@@ -403,7 +369,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
                data->ocd_version, data->ocd_grant);
 
         obd->obd_upcall.onu_owner = &sbi->ll_lco;
-        obd->obd_upcall.onu_upcall = ll_ocd_update;
+        obd->obd_upcall.onu_upcall = cl_ocd_update;
         data->ocd_brw_size = PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT;
 
         err = obd_connect(NULL, &dt_conn, obd, &sbi->ll_sb_uuid, data, NULL);
@@ -429,14 +395,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 
         spin_lock(&sbi->ll_lco.lco_lock);
         sbi->ll_lco.lco_flags = data->ocd_connect_flags;
+        sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
+        sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
         spin_unlock(&sbi->ll_lco.lco_lock);
 
-        err = ll_init_ea_size(sbi->ll_md_exp, sbi->ll_dt_exp);;
-        if (err) {
-                CERROR("cannot set max EA and cookie sizes: rc = %d\n", err);
-                GOTO(out_lock_cn_cb, err);
-        }
-
         fid_zero(&sbi->ll_root_fid);
         err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
         if (err) {
index bf90727..47b6cd7 100644 (file)
@@ -531,25 +531,6 @@ static int mdc_finish_enqueue(struct obd_export *exp,
                         if (eadata == NULL)
                                 RETURN(-EPROTO);
 
-                        if (body->valid & OBD_MD_FLMODEASIZE) {
-                                struct obd_device *obddev = class_exp2obd(exp);
-
-                                if (obddev->u.cli.cl_max_mds_easize <
-                                    body->max_mdsize) {
-                                        obddev->u.cli.cl_max_mds_easize =
-                                                body->max_mdsize;
-                                        CDEBUG(D_INFO, "maxeasize become %d\n",
-                                               body->max_mdsize);
-                                }
-                                if (obddev->u.cli.cl_max_mds_cookiesize <
-                                    body->max_cookiesize) {
-                                        obddev->u.cli.cl_max_mds_cookiesize =
-                                                body->max_cookiesize;
-                                        CDEBUG(D_INFO, "cookiesize become %d\n",
-                                               body->max_cookiesize);
-                                }
-                        }
-
                         /*
                          * We save the reply LOV EA in case we have to replay a
                          * create for recovery.  If we didn't allocate a large
index 8d184b0..f23e8a4 100644 (file)
@@ -180,15 +180,6 @@ static int mdc_getattr_common(struct obd_export *exp,
                         RETURN(-EPROTO);
         }
 
-        if (body->valid & OBD_MD_FLMODEASIZE) {
-                struct client_obd *cli = &exp->exp_obd->u.cli;
-
-                if (cli->cl_max_mds_easize < body->max_mdsize)
-                        cli->cl_max_mds_easize = body->max_mdsize;
-                if (cli->cl_max_mds_cookiesize < body->max_cookiesize)
-                        cli->cl_max_mds_cookiesize = body->max_cookiesize;
-        }
-
         if (body->valid & OBD_MD_FLRMTPERM) {
                 struct mdt_remote_perm *perm;
 
index 48b0f24..de84493 100644 (file)
@@ -1490,6 +1490,48 @@ test_45() { #17310
 }
 run_test 45 "long unlink handling in ptlrpcd"
 
+test_46a() {
+       OSTCOUNT=6
+       reformat
+       start_mds || return 1
+       #first client should see only one ost
+       start_ost || return 2
+       #start_client
+       mount_client $MOUNT || return 3
+       
+       start_ost2 || return 4
+       start ost3 `ostdevname 3` $OST_MOUNT_OPTS || return 5
+       start ost4 `ostdevname 4` $OST_MOUNT_OPTS || return 6
+       start ost5 `ostdevname 5` $OST_MOUNT_OPTS || return 7
+       # wait until ost2-5 is sync
+       sleep 5
+       #second client see both ost's
+
+       mount_client $MOUNT2 || return 8
+       $LFS setstripe $MOUNT2 -c -1 || return 9
+       $LFS getstripe $MOUNT2 || return 10
+
+       echo "ok" > $MOUNT2/widestripe
+       $LFS getstripe $MOUNT2/widestripe || return 11
+       # fill acl buffer for avoid expand lsm to them
+       awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do  
+           setfacl -m $acl $MOUNT2/widestripe
+       done
+
+       # will be deadlock
+       stat $MOUNT/widestripe || return 12
+
+       umount_client $MOUNT2 || return 13
+       umount_client $MOUNT || return 14
+       stop ost5 -f || return 20
+       stop ost4 -f || return 21
+       stop ost3 -f || return 22
+       stop_ost2 || return 23
+       stop_ost || return 24
+       stop_mds || return 25
+}
+run_test 46a "handle ost additional - wide striped file"
+
 cleanup_gss
 equals_msg `basename $0`: test complete
 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true