From e3cd8a5a182ee408744637237a7dca4671c8b5bc Mon Sep 17 00:00:00 2001
From: lsy <lsy>
Date: Wed, 31 Aug 2005 16:05:47 +0000
Subject: [PATCH] change error msg to warning. some cleanup.

---
 lustre/llite/file.c       | 10 +++++-----
 lustre/llite/llite_capa.c |  9 ++++++++-
 lustre/mdc/mdc_request.c  |  2 +-
 lustre/mds/mds_capa.c     |  2 +-
 lustre/obdclass/capa.c    | 29 +++++++++++++++--------------
 5 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/lustre/llite/file.c b/lustre/llite/file.c
index 2adabe9fd9..7f589c6ddd 100644
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -365,8 +365,6 @@ int ll_och_fill(struct inode *inode, struct lookup_intent *it,
         mdc_set_open_replay_data(ll_i2mdexp(inode), och, 
 				 LUSTRE_IT(it)->it_data);
 
-        if (S_ISREG(inode->i_mode) && (body->valid & OBD_MD_CAPA))
-                rc = ll_set_capa(inode, it);
         RETURN(rc);
 }
 
@@ -374,11 +372,12 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
                   struct obd_client_handle *och)
 {
         struct ll_file_data *fd;
+        struct inode *inode = file->f_dentry->d_inode;
         int rc = 0;
         ENTRY;
 
         if (och) {
-                rc = ll_och_fill(file->f_dentry->d_inode, it, och);
+                rc = ll_och_fill(inode, it, och);
                 if (rc)
                         RETURN(rc);
         }
@@ -398,10 +397,11 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
         LASSERT(fd != NULL);
 
         file->private_data = fd;
-        ll_readahead_init(file->f_dentry->d_inode, &fd->fd_ras);
+        ll_readahead_init(inode, &fd->fd_ras);
         fd->fd_omode = it->it_flags;
 
-        RETURN(0);
+        rc = ll_set_capa(inode, it);
+        RETURN(rc);
 }
 
 /* Open a file, and (for the very first open) create objects on the OSTs at
diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c
index 99a9ef3234..3f670d8097 100644
--- a/lustre/llite/llite_capa.c
+++ b/lustre/llite/llite_capa.c
@@ -220,12 +220,19 @@ int ll_set_capa(struct inode *inode, struct lookup_intent *it)
         struct obd_capa *ocapa;
         struct ll_inode_info *lli = ll_i2info(inode);
         unsigned long expiry;
-        ENTRY;
+
+        if (!S_ISREG(inode->i_mode))
+                return 0;
 
         body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
         LASSERT(body != NULL);          /* reply already checked out */
         LASSERT_REPSWABBED(req, 1);     /* and swabbed down */
 
+        if (!(body->valid & OBD_MD_CAPA))
+                return 0;
+
+        ENTRY;
+
         capa = lustre_msg_buf(req->rq_repmsg, 7, sizeof (*capa));
         LASSERT(capa != NULL);          /* reply already checked out */
         LASSERT_REPSWABBED(req, 7);     /* and swabbed down */
diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
index 40788608cd..e69084fccf 100644
--- a/lustre/mdc/mdc_request.c
+++ b/lustre/mdc/mdc_request.c
@@ -112,7 +112,7 @@ mdc_interpret_getattr(struct ptlrpc_request *req, void *unused, int rc)
         ENTRY;
 
         if (rc) {
-                DEBUG_REQ(D_ERROR, req,
+                DEBUG_REQ(D_WARNING, req,
                           "async getattr failed: rc = %d", rc);
                 RETURN(rc);
         }
diff --git a/lustre/mds/mds_capa.c b/lustre/mds/mds_capa.c
index 5e6397429a..c7d0bda3ba 100644
--- a/lustre/mds/mds_capa.c
+++ b/lustre/mds/mds_capa.c
@@ -497,7 +497,7 @@ int mds_pack_capa(struct obd_device *obd, struct mds_export_data *med,
 
                 mfd = mds_handle2mfd(&req_body->handle);
                 if (mfd == NULL) {
-                        DEBUG_CAPA(D_ERROR, req_capa, "no handle "LPX64" for",
+                        DEBUG_CAPA(D_WARNING, req_capa, "no handle "LPX64" for",
                                    req_body->handle.cookie);
                         RETURN(-ESTALE);
                 }
diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c
index 24d34ec1db..7c984990d5 100644
--- a/lustre/obdclass/capa.c
+++ b/lustre/obdclass/capa.c
@@ -55,6 +55,8 @@ struct hlist_head *capa_hash;
 struct list_head capa_list[3];
 static int capa_count[3] = { 0 };
 
+static char *capa_type_name[] = { "client", "mds", "filter" };
+
 /* TODO: mdc and llite all need this, so define it here.
  * in the future it will be moved to ll_sb_info to support multi-
  * mount point */
@@ -109,7 +111,8 @@ find_capa(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid,
                 if (ouid != uid)
                         continue;
 
-                DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "found");
+                DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "found %s",
+                           capa_type_name[ocapa->c_type]);
 
                 return ocapa;
         }
@@ -245,7 +248,8 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa)
 
                 capa_count[type]++;
 
-                DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new");
+                DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new %s",
+                           capa_type_name[type]);
 
                 if (type != CLIENT_CAPA && capa_count[type] > CAPA_CACHE_SIZE) {
                         struct list_head *node = capa_list[type].next;
@@ -259,8 +263,9 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa)
                                 node = node->next;
                                 if (atomic_read(&tcapa->c_refc) > 0)
                                         continue;
-                                DEBUG_CAPA(D_CACHE, &ocapa->c_capa,
-                                           "free unused");
+                                DEBUG_CAPA(D_CACHE, &tcapa->c_capa,
+                                           "free unused %s",
+                                           capa_type_name[type]);
                                 __capa_put(tcapa);
                                 destroy_capa(tcapa);
                                 count++;
@@ -293,7 +298,8 @@ void capa_put(struct obd_capa *ocapa)
         if (!ocapa)
                 return;
 
-        DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "put");
+        DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "put %s",
+                   capa_type_name[ocapa->c_type]);
         spin_lock(&capa_lock);
         if (ocapa->c_type == CLIENT_CAPA) {
                 list_del_init(&ocapa->c_lli_list);
@@ -305,7 +311,7 @@ void capa_put(struct obd_capa *ocapa)
         spin_unlock(&capa_lock);
 }
 
-static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type)
+struct obd_capa *capa_renew(struct lustre_capa *capa, int type)
 {
         uid_t uid = capa->lc_uid;
         int capa_op = capa->lc_op;
@@ -317,8 +323,10 @@ static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type)
 
         spin_lock(&capa_lock);
         ocapa = find_capa(head, uid, capa_op, mdsid, ino, type);
-        if (ocapa)
+        if (ocapa) {
+                DEBUG_CAPA(D_INFO, capa, "renew %s", capa_type_name[type]);
                 do_update_capa(ocapa, capa);
+        }
         spin_unlock(&capa_lock);
 
         if (!ocapa)
@@ -327,13 +335,6 @@ static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type)
         return ocapa;
 }
 
-struct obd_capa *capa_renew(struct lustre_capa *capa, int type)
-{
-        DEBUG_CAPA(D_INFO, capa, "renew");
-
-        return update_capa_locked(capa, type);
-}
-
 void capa_hmac(struct crypto_tfm *tfm, __u8 *key, struct lustre_capa *capa)
 {
         int keylen = CAPA_KEY_LEN;
-- 
GitLab