Whamcloud - gitweb
fix: for each open_client_handle, there will be only one mds_file_data,
authorlsy <lsy>
Tue, 6 Sep 2005 14:00:26 +0000 (14:00 +0000)
committerlsy <lsy>
Tue, 6 Sep 2005 14:00:26 +0000 (14:00 +0000)
     so capability should obtain mfd handle from och->och_fh, instead of
     the one from reply message body, for the latter one has been cleared.

lustre/llite/file.c
lustre/llite/llite_capa.c
lustre/llite/llite_internal.h
lustre/obdfilter/filter_capa.c

index 7f589c6..ef2b04b 100644 (file)
@@ -400,7 +400,6 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
         ll_readahead_init(inode, &fd->fd_ras);
         fd->fd_omode = it->it_flags;
 
-        rc = ll_set_capa(inode, it);
         RETURN(rc);
 }
 
@@ -510,6 +509,12 @@ int ll_file_open(struct inode *inode, struct file *file)
                 rc = ll_local_open(file, it, NULL);
                 if (rc)
                         LBUG();
+
+                rc = ll_set_capa(inode, it, *och_p);
+                if (rc) {
+                        up(&lli->lli_och_sem);
+                        RETURN(rc);
+                }
         } else {
                 LASSERT(*och_usecount == 0);
                 OBD_ALLOC(*och_p, sizeof (struct obd_client_handle));
@@ -545,6 +550,12 @@ int ll_file_open(struct inode *inode, struct file *file)
                 lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_OPEN);
                 rc = ll_local_open(file, it, *och_p);
                 LASSERTF(rc == 0, "rc = %d\n", rc);
+
+                rc = ll_set_capa(inode, it, *och_p);
+                if (rc) {
+                        up(&lli->lli_och_sem);
+                        RETURN(rc);
+                }
         }
         up(&lli->lli_och_sem);
         
index 841857b..132ae45 100644 (file)
@@ -223,7 +223,8 @@ void ll_capa_thread_stop(void)
         EXIT;
 }
 
-int ll_set_capa(struct inode *inode, struct lookup_intent *it)
+int ll_set_capa(struct inode *inode, struct lookup_intent *it,
+                struct obd_client_handle *och)
 {
         struct ptlrpc_request *req = LUSTRE_IT(it)->it_data;
         struct mds_body *body;
@@ -254,7 +255,7 @@ int ll_set_capa(struct inode *inode, struct lookup_intent *it)
 
         spin_lock(&capa_lock);
         ocapa->c_inode = inode;
-        ocapa->c_handle = body->handle;
+        ocapa->c_handle = och->och_fh;
         spin_unlock(&capa_lock);
 
         spin_lock(&lli->lli_lock);
index dc32a6c..3188bfb 100644 (file)
@@ -361,7 +361,8 @@ int ll_capa_thread_start(void);
 void ll_capa_thread_stop(void);
 
 void ll_capa_timer_callback(unsigned long unused);
-int ll_set_capa(struct inode *inode, struct lookup_intent *it);
+int ll_set_capa(struct inode *inode, struct lookup_intent *it,
+                struct obd_client_handle *och);
 int ll_set_trunc_capa(struct ptlrpc_request *req, int offset,
                       struct inode *inode);
 struct obd_capa *ll_get_capa(struct inode *inode, uid_t uid, int op);
index ce01be7..d1d2268 100644 (file)
@@ -238,8 +238,10 @@ filter_verify_capa(int cmd, struct obd_export *exp, struct lustre_capa *capa)
         if (OBD_FAIL_CHECK(OBD_FAIL_FILTER_VERIFY_CAPA))
                 RETURN(-EACCES);
 
-        if (capa_expired(capa))
+        if (capa_expired(capa)) {
+                DEBUG_CAPA(D_INFO, capa, "expired");
                 RETURN(-ESTALE);
+        }
 
         ocapa = capa_get(capa->lc_uid, capa->lc_op, capa->lc_mdsid,
                          capa->lc_ino, FILTER_CAPA);