two bugs and a patch

Nickolai Zeldovich kolya at mit.edu
Fri Jan 12 00:01:44 CET 2001


> I seem to have ran into a new bug though, with the latest checkout
> of arla from CVS:  [...]
>   freebsd% ls | wc -l
>   ls: .: Bad file descriptor

It looks like the patch below fixes the problem, at least for me.
This avoids zeroing out the vnode attrs when installattr is called,
because the xfs attrs struct contains nothing to replace it with
(in case of FCACHE2XFSNODE_RIGHT).

-- kolya

--- xfs_message.c	2001/01/07 00:09:44	1.64
+++ xfs_message.c	2001/01/11 23:01:51
@@ -134,7 +134,7 @@
 	    printf ("xfs_message_installattr: tokens and no data\n");
 	    t->tokens &= ~XFS_DATA_MASK;
 	}
-	xfs_attr2vattr(&message->node.attr, &t->attr);
+	xfs_attr2vattr(&message->node.attr, &t->attr, 0);
 	xfs_set_vp_size(XNODE_TO_VNODE(t), t->attr.va_size);
 	bcopy(message->node.id, t->id, sizeof(t->id));
 	bcopy(message->node.rights, t->rights, sizeof(t->rights));
@@ -210,7 +210,7 @@
 			     (unsigned long)t, message->node.tokens));
 
 	    t->tokens = message->node.tokens;
-	    xfs_attr2vattr(&message->node.attr, &t->attr);
+	    xfs_attr2vattr(&message->node.attr, &t->attr, 1);
 	    xfs_set_vp_size(XNODE_TO_VNODE(t), t->attr.va_size);
 	    if (XNODE_TO_VNODE(t)->v_type == VDIR
 		&& (message->flag & XFS_ID_INVALID_DNLC))

--- xfs_node-bsd.c	2000/10/02 23:32:19	1.47
+++ xfs_node-bsd.c	2001/01/11 23:01:52
@@ -124,7 +124,7 @@
     }
 
     /* Init other fields */
-    xfs_attr2vattr(&node->attr, &result->attr);
+    xfs_attr2vattr(&node->attr, &result->attr, 1);
     result->vn->v_type = result->attr.va_type;
     XFS_TOKEN_SET(result, XFS_ATTR_R, XFS_ATTR_MASK);
     bcopy(node->id, result->id, sizeof(result->id));
@@ -313,9 +313,10 @@
 #define SET_TIMEVAL(X, S, N) do { (X)->tv_sec = (S); (X)->tv_nsec = (N); } while(0)
 
 void
-xfs_attr2vattr(const struct xfs_attr *xa, struct vattr *va)
+xfs_attr2vattr(const struct xfs_attr *xa, struct vattr *va, int clear)
 {
-    VATTR_NULL(va);
+    if (clear)
+	VATTR_NULL(va);
     if (XA_VALID_MODE(xa))
 	va->va_mode = xa->xa_mode;
     if (XA_VALID_NLINK(xa))

--- xfs_node-osf.c	2000/10/02 23:32:24	1.14
+++ xfs_node-osf.c	2001/01/11 23:01:52
@@ -96,7 +96,7 @@
     }
 
     /* Init other fields */
-    xfs_attr2vattr(&node->attr, &result->attr);
+    xfs_attr2vattr(&node->attr, &result->attr, 1);
     result->vn->v_type = result->attr.va_type;
     XFS_TOKEN_SET(result, XFS_ATTR_R, XFS_ATTR_MASK);
     bcopy(node->id, result->id, sizeof(result->id));
@@ -262,9 +262,10 @@
 #define SET_TIMEVAL(X, S, N) do { (X)->tv_sec = (S); (X)->tv_usec = (N) / 1000; } while(0)
 
 void
-xfs_attr2vattr(const struct xfs_attr *xa, struct vattr *va)
+xfs_attr2vattr(const struct xfs_attr *xa, struct vattr *va, int clear)
 {
-    VATTR_NULL(va);
+    if (clear)
+	VATTR_NULL(va);
     if (XA_VALID_MODE(xa))
 	va->va_mode = xa->xa_mode;
     if (XA_VALID_NLINK(xa))

--- xfs/xfs_fs.h	2000/10/02 23:34:28	1.18
+++ xfs/xfs_fs.h	2001/01/11 23:01:54
@@ -88,7 +88,7 @@
 int xfs_dnlc_lookup_name(struct vnode *, const char *, struct vnode **);
 
 void vattr2xfs_attr(const struct vattr *, struct xfs_attr *);
-void xfs_attr2vattr(const struct xfs_attr *, struct vattr *);
+void xfs_attr2vattr(const struct xfs_attr *, struct vattr *, int);
 
 int xfs_has_pag(const struct xfs_node *, xfs_pag_t);
 





More information about the Arla-drinkers mailing list