From 5339dfe4986a925a95b80dbf103e448cb44c3bf6 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Wed, 4 Sep 2013 12:22:27 +0200 Subject: [PATCH] tmpfs - Remove duplicated checks in tmpfs_chflags() * Do not duplicate the checks that vop_helper_setattr_flags() already performed. * On tmpfs_mount(), root node already has set SF_NOCACHE on its vnode. --- sys/vfs/tmpfs/tmpfs_subr.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/sys/vfs/tmpfs/tmpfs_subr.c b/sys/vfs/tmpfs/tmpfs_subr.c index 678fd1da3c..8310b88991 100644 --- a/sys/vfs/tmpfs/tmpfs_subr.c +++ b/sys/vfs/tmpfs/tmpfs_subr.c @@ -1032,29 +1032,10 @@ tmpfs_chflags(struct vnode *vp, int vaflags, struct ucred *cred) return EROFS; error = vop_helper_setattr_flags(&flags, vaflags, node->tn_uid, cred); - /* - * Unprivileged processes are not permitted to unset system - * flags, or modify flags if any system flags are set. - * - * Silently enforce SF_NOCACHE on the root tmpfs vnode so - * tmpfs data is not double-cached by swapcache. - */ + /* Actually change the flags on the node itself */ if (error == 0) { TMPFS_NODE_LOCK(node); - if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (vp->v_flag & VROOT) - flags |= SF_NOCACHE; - node->tn_flags = flags; - } else { - if (node->tn_flags & (SF_NOUNLINK | SF_IMMUTABLE | - SF_APPEND) || - (flags & UF_SETTABLE) != flags) { - error = EPERM; - } else { - node->tn_flags &= SF_SETTABLE; - node->tn_flags |= (flags & UF_SETTABLE); - } - } + node->tn_flags = flags; node->tn_status |= TMPFS_NODE_CHANGED; TMPFS_NODE_UNLOCK(node); } -- 2.41.0