Whamcloud - gitweb
- Fixed remote dlm lock conversion
authorpschwan <pschwan>
Fri, 14 Jun 2002 21:32:12 +0000 (21:32 +0000)
committerpschwan <pschwan>
Fri, 14 Jun 2002 21:32:12 +0000 (21:32 +0000)
- More intent lock progress

lustre/ldlm/ldlm_lockd.c
lustre/llite/namei.c
lustre/obdfilter/filter.c
lustre/ptlrpc/connection.c
lustre/tests/.cvsignore
lustre/tests/intent-test.sh
lustre/tests/llmountcleanup.sh

index 93c9e19..980f8b2 100644 (file)
@@ -171,7 +171,8 @@ static int _ldlm_enqueue(struct obd_device *obddev, struct ptlrpc_service *svc,
 
 static int _ldlm_convert(struct ptlrpc_service *svc, struct ptlrpc_request *req)
 {
-        struct ldlm_request *dlm_req, *dlm_rep;
+        struct ldlm_request *dlm_req;
+        struct ldlm_reply *dlm_rep;
         struct ldlm_resource *res;
         int rc, size = sizeof(*dlm_rep);
         ENTRY;
@@ -449,8 +450,10 @@ static int __init ldlm_init(void)
 static void __exit ldlm_exit(void)
 {
         obd_unregister_type(OBD_LDLM_DEVICENAME);
-        kmem_cache_destroy(ldlm_resource_slab);
-        kmem_cache_destroy(ldlm_lock_slab);
+        if (kmem_cache_destroy(ldlm_resource_slab) != 0)
+                CERROR("couldn't free ldlm resource slab\n");
+        if (kmem_cache_destroy(ldlm_lock_slab) != 0)
+                CERROR("couldn't free ldlm lock slab\n");
 }
 
 EXPORT_SYMBOL(ldlm_local_lock_match);
index e91e03d..87166e2 100644 (file)
@@ -227,9 +227,11 @@ static struct inode *ll_create_node(struct inode *dir, const char *name,
                         GOTO(out, rc);
                 }
                 body = lustre_msg_buf(request->rq_repmsg, 0);
+                md.obdo = obdo;
         } else {
                 request = it->it_data;
                 body = lustre_msg_buf(request->rq_repmsg, 1);
+                md.obdo = NULL;
         }
 
         body->valid = (__u32)OBD_MD_FLNOTOBD;
@@ -241,7 +243,6 @@ static struct inode *ll_create_node(struct inode *dir, const char *name,
         body->mode = mode;
 
         md.body = body;
-        md.obdo = obdo;
 
         inode = iget4(dir->i_sb, body->ino, ll_find_inode, &md);
         if (IS_ERR(inode)) {
index 863f96b..49e46b0 100644 (file)
@@ -255,6 +255,7 @@ static struct dentry *filter_fid2dentry(struct obd_device *obddev,
 
         if (id == 0) {
                 CERROR("fatal: invalid object #0\n");
+                LBUG();
                 RETURN(ERR_PTR(-ESTALE));
         }
 
@@ -1157,6 +1158,8 @@ static int filter_preprw(int cmd, struct obd_conn *conn,
                 dentry = filter_fid2dentry(obddev,
                                            filter_parent(obddev, S_IFREG),
                                            o->ioo_id, S_IFREG);
+                if (IS_ERR(dentry))
+                        GOTO(out_ctxt, rc = PTR_ERR(dentry));
                 inode = dentry->d_inode;
 
                 for (j = 0; j < o->ioo_bufcnt; j++, b++, r++) {
@@ -1177,7 +1180,7 @@ static int filter_preprw(int cmd, struct obd_conn *conn,
 
                         /* FIXME: we need to iput all inodes on error */
                         if (!inode)
-                                RETURN(-EINVAL);
+                                GOTO(out_ctxt, rc = -EINVAL);
 
                         if (cmd == OBD_BRW_WRITE) {
                                 page = filter_get_page_write(inode, index, r);
@@ -1193,7 +1196,7 @@ static int filter_preprw(int cmd, struct obd_conn *conn,
 
                         /* FIXME: we need to clean up here... */
                         if (IS_ERR(page))
-                                RETURN(PTR_ERR(page));
+                                GOTO(out_ctxt, rc = PTR_ERR(page));
 
                         r->addr = page_address(page);
                         r->offset = b->offset;
index 71dc337..992815d 100644 (file)
@@ -38,7 +38,7 @@ struct ptlrpc_connection *ptlrpc_get_connection(struct lustre_peer *peer)
         list_for_each(tmp, &conn_list) {
                 c = list_entry(tmp, struct ptlrpc_connection, c_link);
                 if (memcmp(peer, &c->c_peer, sizeof(*peer)) == 0) {
-                        atomic_inc(&c->c_refcount);
+                        ptlrpc_connection_addref(c);
                         GOTO(out, c);
                 }
         }
@@ -46,7 +46,7 @@ struct ptlrpc_connection *ptlrpc_get_connection(struct lustre_peer *peer)
         list_for_each_safe(tmp, pos, &conn_unused_list) {
                 c = list_entry(tmp, struct ptlrpc_connection, c_link);
                 if (memcmp(peer, &c->c_peer, sizeof(*peer)) == 0) {
-                        atomic_inc(&c->c_refcount);
+                        ptlrpc_connection_addref(c);
                         list_del(&c->c_link);
                         list_add(&c->c_link, &conn_list);
                         GOTO(out, c);
@@ -65,7 +65,8 @@ struct ptlrpc_connection *ptlrpc_get_connection(struct lustre_peer *peer)
         c->c_generation = 1;
         c->c_epoch = 1;
         c->c_bootcount = 0;
-        atomic_set(&c->c_refcount, 1);
+        atomic_set(&c->c_refcount, 0);
+        ptlrpc_connection_addref(c);
         spin_lock_init(&c->c_lock);
 
         memcpy(&c->c_peer, peer, sizeof(c->c_peer));
@@ -82,6 +83,7 @@ int ptlrpc_put_connection(struct ptlrpc_connection *c)
         int rc = 0;
         ENTRY;
 
+        CDEBUG(D_INFO, "connection=%p\n", c);
         if (atomic_dec_and_test(&c->c_refcount)) {
                 spin_lock(&conn_lock);
                 list_del(&c->c_link);
@@ -90,7 +92,7 @@ int ptlrpc_put_connection(struct ptlrpc_connection *c)
                 rc = 1;
         }
         if (atomic_read(&c->c_refcount) < 0)
-                CERROR("refcount < 0!\n");
+                CERROR("refcount < 0 for connection %p!\n", c);
 
         RETURN(rc);
 }
@@ -98,6 +100,7 @@ int ptlrpc_put_connection(struct ptlrpc_connection *c)
 struct ptlrpc_connection *ptlrpc_connection_addref(struct ptlrpc_connection *c)
 {
         ENTRY;
+        CDEBUG(D_INFO, "connection=%p\n", c);
         atomic_inc(&c->c_refcount);
         RETURN(c);
 }
index d101b52..c6322cb 100644 (file)
@@ -14,4 +14,5 @@ openme
 writeme
 mcreate
 tchmod
+toexcl
 fsx
index 17d9bbc..c9fb323 100755 (executable)
@@ -60,19 +60,39 @@ cat /mnt/lustre/bar4
 umount /mnt/lustre
 mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
 
-touch /mnt/lustre/bar
-touch /mnt/lustre/bar2
+touch /mnt/lustre/bar5
+touch /mnt/lustre/bar6
+touch /mnt/lustre/bar5
 
-touch /mnt/lustre/bar
+umount /mnt/lustre
+mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
+
+touch /mnt/lustre/bar5
+
+umount /mnt/lustre
+mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
+
+echo "ready debugger"
+read
+
+echo foo >> /mnt/lustre/bar
 
 umount /mnt/lustre
 mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
 
-touch /mnt/lustre/bar
+cat /mnt/lustre/bar
 
 exit;
 
-echo foo >> /mnt/lustre/bar
+echo foo >> /mnt/lustre/iotest
+echo bar >> /mnt/lustre/iotest
+cat /mnt/lustre/iotest
+
+umount /mnt/lustre
+mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
+
+cat /mnt/lustre/iotest
+echo baz >> /mnt/lustre/iotest
 
 umount /mnt/lustre
 mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
@@ -91,3 +111,8 @@ mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
 ls /mnt/lustre
 mkdir /mnt/lustre/newer
 ls /mnt/lustre
+
+umount /mnt/lustre
+mount -t lustre_lite -o ost=5,mds=6 none /mnt/lustre
+
+cat /mnt/lustre/iotest
\ No newline at end of file
index 674be92..7287d68 100755 (executable)
@@ -5,7 +5,7 @@ SRCDIR="`dirname $0`/"
 
 TIME=`date +'%s'`
 
-$DBGCTL debug_kernel /tmp/debug.1.$TIME
+$DBGCTL debug_kernel /tmp/debug.1.$TIME 1
 
 if mount | grep '/mnt/lustre'; then
        umount /mnt/lustre || fail "cannot unmount"
@@ -54,7 +54,7 @@ rmmod ptlrpc
 rmmod obdclass
 rmmod extN
 
-$DBGCTL debug_kernel /tmp/debug.2.$TIME
+$DBGCTL debug_kernel /tmp/debug.2.$TIME 1
 
 $PTLCTL <<EOF
 setup tcp