From 1c08d5b7f0de0759e3b605161b0ca98c2cd66dd1 Mon Sep 17 00:00:00 2001
From: yury <yury>
Date: Thu, 11 Aug 2005 07:32:52 +0000
Subject: [PATCH] - set only LOV_EA in mds_reint_setattr() in the case of CMOBD
 reint as setting sid and pid will confuse master MDS. - set mds_security to
 "null" in lustre_connect_mds() if not specified or panic is possible.

---
 lustre/llite/llite_lib.c |  4 ++++
 lustre/mds/mds_reint.c   | 24 ++++++++++++++----------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index f033377a74..279eb27b55 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -153,6 +153,9 @@ static int lustre_connect_mds(struct super_block *sb, char *lmv,
         obd_set_info(md_obd->obd_self_export, strlen("async"), "async",
                      sizeof(async), &async);
 
+        if (mds_security == NULL)
+                mds_security = "null";
+        
         err = obd_set_info(md_obd->obd_self_export, strlen("sec"), "sec",
                            strlen(mds_security), mds_security);
         
@@ -230,6 +233,7 @@ out_disconnect:
 out:
         RETURN(err);
 }
+
 static int lustre_connect_ost(struct super_block *sb, char *lov, 
                               struct obd_connect_data *data, 
                               char *oss_security, int async, int pag)
diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c
index eb2c1dc20e..8b681099eb 100644
--- a/lustre/mds/mds_reint.c
+++ b/lustre/mds/mds_reint.c
@@ -599,24 +599,27 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
                         char *name;
                         int type;
                         
-                        /* tmp fix for cmobd set md reint */
                         LASSERT(rec->ur_eadata != NULL);
                         LASSERT(rec->ur_ea2data != NULL);
                         name = rec->ur_eadata;
-                        
-                        CDEBUG(D_INFO, "set %s EA for cmobd \n", name);
 
+                        /* XXX: tmp fix for setting LOV EA from CMOBD */
                         type = mds_get_md_type(name);
-                        if (type != 0) {
+
+                        if (type == EA_LOV) {
+                                CDEBUG(D_INFO, "set %s EA for cmobd \n", name);
+
                                 rc = fsfilt_set_md(obd, inode, handle, 
                                                    rec->ur_ea2data,
-                                                   rec->ur_ea2datalen, type);
+                                                   rec->ur_ea2datalen,
+                                                   type);
+                                if (rc)
+                                        GOTO(cleanup, rc);
                         }
-                        if (rc)
-                                GOTO(cleanup, rc);               
                 } else if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) &&
                            !((rec->ur_iattr.ia_valid & ATTR_KEY) || 
                              (rec->ur_iattr.ia_valid & ATTR_MAC))) {
+                        
                         struct lov_stripe_md *lsm = NULL;
                         struct lov_user_md *lum = NULL;
 
@@ -648,11 +651,12 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
                                                 GOTO(cleanup, rc);
                                 }
                         }
-                }   
-                if ((rec->ur_iattr.ia_valid & ATTR_KEY) || 
-                    (rec->ur_iattr.ia_valid & ATTR_MAC)) {
+                }
+                
+                if ((rec->ur_iattr.ia_valid & ATTR_KEY) || (rec->ur_iattr.ia_valid & ATTR_MAC)) {
                         void *key;
                         int keylen;
+                        
                         LASSERT(rec->ur_eadatalen || rec->ur_ea3datalen); 
                         LASSERT(rec->ur_eadata || rec->ur_ea3data); 
                         key = rec->ur_ea3data ? rec->ur_ea3data : rec->ur_eadata;
-- 
GitLab