Arla 0.25 on Linux 2.2.10 bug

Assar Westerlund assar at stacken.kth.se
Tue Jun 29 11:40:33 CEST 1999


I wrote:
> > A related problem is that when a directory entry of a file with
> > a link count >= 3 is deleted, the link count of the remaining
> > directory entries is not decreased.  However, when I remove one
> > of two directory entries of a file, the remaining one shows a
> > correct link count of 1.  Unfortunately, I don't have a patch for
> > this.
> 
> As you say, that's a little bit harder.  I'll have to think about that
> some more.

Can you try the following patch?

/assar

Index: arlad/messages.c
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/arlad/messages.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -w -u -w -r1.134 -r1.135
--- messages.c	1999/06/29 02:28:18	1.134
+++ messages.c	1999/06/29 09:26:52	1.135
@@ -1325,12 +1325,16 @@
 xfs_message_remove (int fd, struct xfs_message_remove *h, u_int size)
 {
      VenusFid *parent_fid;
+     VenusFid fid;
      Result res;
      CredCacheEntry *ce;
      int ret;
-     struct xfs_message_installdata msg;
+     struct xfs_message_installdata msg1;
+     struct xfs_message_installattr msg2;
      struct xfs_message_header *h0 = NULL;
      size_t h0_len = 0;
+     struct xfs_message_header *h1 = NULL;
+     size_t h1_len = 0;
 
      parent_fid = (VenusFid *)&h->parent_handle;
 
@@ -1338,6 +1342,10 @@
      assert (ce != NULL);
 
      do {
+	 res = cm_lookup (*parent_fid, h->name, &fid, &ce);
+     } while (try_again (&ret, &ce, &h->cred, parent_fid));
+
+     do {
 	 res = cm_remove(*parent_fid, h->name, ce);
 
 	 if (res.res)
@@ -1348,6 +1356,7 @@
 
      if (res.res == 0) {
 	 FCacheEntry *dir_entry;
+	 FCacheEntry *limbo_entry;
 
 	 ret = fcache_get (&dir_entry, *parent_fid, ce);
 	 if (ret)
@@ -1361,9 +1370,9 @@
 	 }
 	     
 	 ret = dir_remove_name (dir_entry, h->name,
-				&msg.cache_handle,
-				msg.cache_name,
-				sizeof(msg.cache_name));
+				&msg1.cache_handle,
+				msg1.cache_name,
+				sizeof(msg1.cache_name));
 	 if (ret) {
 	     fcache_release (dir_entry);
 	     goto out;
@@ -1383,23 +1392,43 @@
 	 }
 #endif
 
-	 msg.flag = XFS_INVALID_DNLC;
-	 msg.node.tokens = res.tokens | XFS_DATA_R;
+	 msg1.flag = XFS_INVALID_DNLC;
+	 msg2.node.tokens = res.tokens | XFS_DATA_R;
 
 	 fcacheentry2xfsnode (parent_fid,
 			      &dir_entry->realfid,
-			      &dir_entry->status, &msg.node,
+			      &dir_entry->status, &msg1.node,
 			      dir_entry->acccache);
 	 
-	 msg.header.opcode = XFS_MSG_INSTALLDATA;
-	 h0 = (struct xfs_message_header *)&msg;
-	 h0_len = sizeof(msg);
+	 msg1.header.opcode = XFS_MSG_INSTALLDATA;
+	 h0 = (struct xfs_message_header *)&msg1;
+	 h0_len = sizeof(msg1);
 #else
 	 break_callback (*parent_fid);
 #endif
 	 fcache_release(dir_entry);
+
+	 ret = fcache_get (&limbo_entry, fid, ce);
+	 if (ret)
+	     goto out;
+
+	 ret = fcache_get_attr (limbo_entry, ce);
+	 if (ret) {
+	     fcache_release (limbo_entry);
+	     goto out;
      }
+	 msg2.header.opcode = XFS_MSG_INSTALLATTR;
+	 msg2.node.tokens   = limbo_entry->tokens;
+	 fcacheentry2xfsnode (&fid,
+			      &limbo_entry->realfid,
+			      &limbo_entry->status, &msg2.node,
+			      limbo_entry->acccache);
 
+	 h1 = (struct xfs_message_header *)&msg2;
+	 h1_len = sizeof(msg2);
+	 fcache_release (limbo_entry);
+     }
+
 out:
      cred_free (ce);
      xfs_send_message_wakeup_multiple (fd,
@@ -1408,6 +1437,7 @@
 #if 1
 				       h0, h0_len,
 #endif
+				       h1, h1_len,
 				       NULL, 0);
      return ret;
 }





More information about the Arla-drinkers mailing list