Module Name:    src
Committed By:   christos
Date:           Thu Aug 20 20:28:13 UTC 2020

Modified Files:
        src/sys/ufs/ffs: ffs_vfsops.c
        src/sys/ufs/ufs: inode.h ufs_vnops.c

Log Message:
Don't cache id's for vnodes that have ACLs. ok chs@


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.77 -r1.78 src/sys/ufs/ufs/inode.h
cvs rdiff -u -r1.255 -r1.256 src/sys/ufs/ufs/ufs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.371 src/sys/ufs/ffs/ffs_vfsops.c:1.372
--- src/sys/ufs/ffs/ffs_vfsops.c:1.371	Sun Jul  5 16:37:40 2020
+++ src/sys/ufs/ffs/ffs_vfsops.c	Thu Aug 20 16:28:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.371 2020/07/05 20:37:40 christos Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.372 2020/08/20 20:28:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.371 2020/07/05 20:37:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.372 2020/08/20 20:28:13 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2139,7 +2139,7 @@ ffs_loadvnode(struct mount *mp, struct v
 		ip->i_gid = ip->i_ffs1_ogid;			/* XXX */
 	}							/* XXX */
 	uvm_vnp_setsize(vp, ip->i_size);
-	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, true);
+	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, !HAS_ACLS(ip));
 	*new_key = &ip->i_number;
 	return 0;
 }
@@ -2261,7 +2261,7 @@ ffs_newvnode(struct mount *mp, struct vn
 	}
 
 	uvm_vnp_setsize(vp, ip->i_size);
-	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, true);
+	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, !HAS_ACLS(ip));
 	*new_key = &ip->i_number;
 	return 0;
 }

Index: src/sys/ufs/ufs/inode.h
diff -u src/sys/ufs/ufs/inode.h:1.77 src/sys/ufs/ufs/inode.h:1.78
--- src/sys/ufs/ufs/inode.h:1.77	Sat Apr 18 15:18:34 2020
+++ src/sys/ufs/ufs/inode.h	Thu Aug 20 16:28:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: inode.h,v 1.77 2020/04/18 19:18:34 christos Exp $	*/
+/*	$NetBSD: inode.h,v 1.78 2020/08/20 20:28:13 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -238,6 +238,14 @@ struct inode {
 #if defined(_KERNEL)
 
 /*
+ * This macro does not differentiate between having extattrs and having
+ * extattrs containing ACLS, but that's ok since it is only used to
+ * determine if we are eligible for namei cache and we can be pessimistic
+ */
+#define HAS_ACLS(ip) \
+    ((ip)->i_ump->um_fstype == UFS2 && (ip)->i_ffs2_extsize > 0)
+
+/*
  * The DIP macro is used to access fields in the dinode that are
  * not cached in the inode itself.
  */

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.255 src/sys/ufs/ufs/ufs_vnops.c:1.256
--- src/sys/ufs/ufs/ufs_vnops.c:1.255	Mon May 18 04:28:44 2020
+++ src/sys/ufs/ufs/ufs_vnops.c	Thu Aug 20 16:28:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.255 2020/05/18 08:28:44 hannken Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.256 2020/08/20 20:28:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.255 2020/05/18 08:28:44 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.256 2020/08/20 20:28:13 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -669,7 +669,7 @@ ufs_setattr(void *v)
 	}
 	VN_KNOTE(vp, NOTE_ATTRIB);
 out:
-	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, true);
+	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, !HAS_ACLS(ip));
 	return (error);
 }
 
@@ -740,7 +740,7 @@ ufs_chmod(struct vnode *vp, int mode, ka
 	ip->i_flag |= IN_CHANGE;
 	DIP_ASSIGN(ip, mode, ip->i_mode);
 	UFS_WAPBL_UPDATE(vp, NULL, NULL, 0);
-	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, true);
+	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, !HAS_ACLS(ip));
 	return (0);
 }
 
@@ -810,7 +810,7 @@ ufs_chown(struct vnode *vp, uid_t uid, g
 #endif /* QUOTA || QUOTA2 */
 	ip->i_flag |= IN_CHANGE;
 	UFS_WAPBL_UPDATE(vp, NULL, NULL, 0);
-	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, true);
+	cache_enter_id(vp, ip->i_mode, ip->i_uid, ip->i_gid, !HAS_ACLS(ip));
 	return (0);
 }
 

Reply via email to