Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jan 2017 10:29:24 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r312798 - stable/10/sys/fs/tmpfs
Message-ID:  <201701261029.v0QATOpY037868@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Jan 26 10:29:23 2017
New Revision: 312798
URL: https://svnweb.freebsd.org/changeset/base/312798

Log:
  MFC r311531 (by mjg):
  Perform a lockless check in tmpfs_itimes.

Modified:
  stable/10/sys/fs/tmpfs/tmpfs_subr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- stable/10/sys/fs/tmpfs/tmpfs_subr.c	Thu Jan 26 10:19:53 2017	(r312797)
+++ stable/10/sys/fs/tmpfs/tmpfs_subr.c	Thu Jan 26 10:29:23 2017	(r312798)
@@ -1745,19 +1745,22 @@ tmpfs_set_status(struct tmpfs_node *node
 }
 
 /* Sync timestamps */
-static void
-tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc,
+void
+tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
     const struct timespec *mod)
 {
+	struct tmpfs_node *node;
 	struct timespec now;
 
-	TMPFS_ASSERT_LOCKED(node);
+	ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
+	node = VP_TO_TMPFS_NODE(vp);
 
 	if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
 	    TMPFS_NODE_CHANGED)) == 0)
 		return;
 
 	vfs_timestamp(&now);
+	TMPFS_NODE_LOCK(node);
 	if (node->tn_status & TMPFS_NODE_ACCESSED) {
 		if (acc == NULL)
 			 acc = &now;
@@ -1772,19 +1775,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n
 		node->tn_ctime = now;
 	node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
 	    TMPFS_NODE_CHANGED);
-}
-
-void
-tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
-    const struct timespec *mod)
-{
-	struct tmpfs_node *node;
-
-	ASSERT_VOP_LOCKED(vp, "tmpfs_itimes");
-	node = VP_TO_TMPFS_NODE(vp);
-
-	TMPFS_NODE_LOCK(node);
-	tmpfs_itimes_locked(node, acc, mod);
 	TMPFS_NODE_UNLOCK(node);
 
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701261029.v0QATOpY037868>