summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-09-21 14:02:43 +0000
committered <ed@FreeBSD.org>2008-09-21 14:02:43 +0000
commitb03d0693f25e6f471525010c9ed9d1e92c010ee8 (patch)
tree4bd60d6847b20d4076abb0427473df8e0e9a8cb3
parent8eda466e5cb0ccd081b50a0dece0bde6afa146b0 (diff)
downloadFreeBSD-src-b03d0693f25e6f471525010c9ed9d1e92c010ee8.zip
FreeBSD-src-b03d0693f25e6f471525010c9ed9d1e92c010ee8.tar.gz
Already initialize the vfs timestamps inside the cdev upon allocation.
In the MPSAFE TTY branch I noticed the vfs timestamps inside devfs were allocated with 0, where the getattr() routine bumps the timestamps to boottime if the value is below 3600. The reason why it has been designed like this, is because timestamps during boot are likely to be invalid. This means that device nodes that are created on demand (posix_openpt()) have timestamps with a value of boottime, which is not what we want. Solve this by calling vfs_timestamp() inside devfs_alloc(). Discussed with: kib
-rw-r--r--sys/fs/devfs/devfs_devs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 45f8d58..028f5c9 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -117,6 +117,7 @@ devfs_alloc(void)
{
struct cdev_priv *cdp;
struct cdev *cdev;
+ struct timespec ts;
cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_WAITOK);
@@ -128,6 +129,9 @@ devfs_alloc(void)
cdev->si_name = cdev->__si_namebuf;
LIST_INIT(&cdev->si_children);
+ vfs_timestamp(&ts);
+ cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
+
return (cdev);
}
OpenPOWER on IntegriCloud