cachefs_strict.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/pathname.h>
#include <sys/sysmacros.h>
#include <sys/bootconf.h>
static int
{
int error;
/* if attributes not passed in then get them */
/* if not connected then cannot get attrs */
return (ETIMEDOUT);
/* get backvp if necessary */
if (error)
return (error);
}
/* get the attributes */
if (error)
return (error);
} else {
/* copy passed in attributes into the cnode */
}
/*
* Expire time is based on the number of seconds since
* the last change.
* (i.e. files that changed recently are likely to change soon)
*/
return (0);
}
static int
{
int error = 0;
#ifdef CFSDEBUG
printf("c_strict_check_cached_object: ENTER cp %p\n",
(void *)cp);
#endif
goto out;
/*
* If backfs is NFSv4, do a getattr to update link count,
* all other attributes are not used, and the backfs is
* called on a getattr request.
*/
if (CFS_ISFS_BACKFS_NFSV4(fscp)) {
backhit = 1;
if (error)
goto out;
goto out;
}
/* done if do not have to check and time has not expired */
if (((verify_what & C_BACK_CHECK) == 0) &&
goto out;
/* get backvp if necessary */
if (error)
goto out;
}
/*
* If the cnode is being populated, and we're not the populating
* thread, then block until the pop thread completes. If we are the
* pop thread, then we may come in here, but not to nuke the directory
* cnode at a critical juncture.
*/
/*
* recheck backvp and connectivity - if backvp now null,
* something bad happened, so don't bother trying to 'get' it
*/
}
goto out;
}
}
/* get the file attributes from the back fs */
backhit = 1;
if (error)
goto out;
/* if the mtime or size of the file has changed */
fail = 1;
#ifdef CFSDEBUG
printf("c_strict_check: invalidating %llu\n",
#endif
goto out;
error = 0;
/*
* if an async pop started while the lock was
* dropped, go back and try again
*/
goto again;
}
/*
* We should properly handle the CN_NOCACHE flag here.
* In fact, we should remember that cachefs_inval_object()
* state of the flag over the call.
*/
else {
}
if (error)
goto out;
}
}
#ifdef CFSDEBUG
else {
printf("c_strict_check: v_pages not null\n");
}
#endif
}
/* toss cached acl info if ctime changed */
}
out:
if (backhit != 0) {
if (fail != 0)
else
}
#ifdef CFSDEBUG
printf("c_strict_check_cached_object: EXIT expires %lx\n",
#endif
return (error);
}
static void
{
int error = 0;
/*
* Don't do a getattr if NFSv4, which maintains
* its attributes (and link count) by doing a call
* to CFSOP_CHECK_COBJECT() during vnode operations.
*/
if (CFS_ISFS_BACKFS_NFSV4(fscp))
goto out;
/* from now on, make sure we're using the server's idea of time */
/* if in write-around mode, make sure file is nocached */
if (CFS_ISFS_WRITE_AROUND(fscp)) {
/*
* If a directory, then defer getting the new attributes
* until requested. Might be a little bit faster this way.
*/
goto out;
}
/* get the new mtime so the next call to check_cobject does not fail */
if (error) {
goto out;
}
}
if (error) {
goto out;
}
out:
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*
* Returns the tod in secs when the consistency of the object should
* be checked.
*/
static time_t
{
/*
* Expire time is based on the number of seconds since the last change
* (i.e. files that changed recently are likely to change soon),
*/
} else {
}
now = gethrestime_sec();
return (xsec);
}
struct cachefsops strictcfsops = {
};