예제 #1
0
static int
smb_fem_oplock_vnevent(
    femarg_t		*arg,
    vnevent_t		vnevent,
    vnode_t		*dvp,
    char		*name,
    caller_context_t	*ct)
{
	uint32_t	flags;
	int		rc = 0;

	if (ct != &smb_ct) {
		switch (vnevent) {
		case VE_REMOVE:
		case VE_RENAME_DEST:
			flags = SMB_OPLOCK_BREAK_TO_NONE |
			    SMB_OPLOCK_BREAK_BATCH;
			rc = smb_fem_oplock_break(arg, ct, flags);
			break;
		case VE_RENAME_SRC:
			flags = SMB_OPLOCK_BREAK_TO_LEVEL_II |
			    SMB_OPLOCK_BREAK_BATCH;
			rc = smb_fem_oplock_break(arg, ct, flags);
			break;
		default:
			rc = 0;
			break;
		}
	}
	if (rc == 0)
		rc = vnext_vnevent(arg, vnevent, dvp, name, ct);

	return (rc);
}
예제 #2
0
/*
 * FEM oplock monitors
 *
 * The monitors below are not intended to intercept CIFS calls.
 * CIFS higher-level routines will break oplocks as needed prior
 * to getting to the VFS layer.
 */
static int
smb_fem_oplock_open(
    femarg_t		*arg,
    int			mode,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc;

	rc = smb_fem_oplock_break(arg, ct);
	if (rc == 0)
		rc = vnext_open(arg, mode, cr, ct);
	return (rc);
}
예제 #3
0
static int
smb_fem_oplock_setsecattr(
    femarg_t		*arg,
    vsecattr_t		*vsap,
    int			flag,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc;

	rc = smb_fem_oplock_break(arg, ct);
	if (rc == 0)
		rc = vnext_setsecattr(arg, vsap, flag, cr, ct);
	return (rc);
}
예제 #4
0
static int
smb_fem_oplock_rwlock(
    femarg_t		*arg,
    int			write_lock,
    caller_context_t	*ct)
{
	if (write_lock) {
		int	rc;

		rc = smb_fem_oplock_break(arg, ct);
		if (rc != 0)
			return (rc);
	}
	return (vnext_rwlock(arg, write_lock, ct));
}
예제 #5
0
static int
smb_fem_oplock_write(
    femarg_t		*arg,
    uio_t		*uiop,
    int			ioflag,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc;

	rc = smb_fem_oplock_break(arg, ct);
	if (rc == 0)
		rc = vnext_write(arg, uiop, ioflag, cr, ct);
	return (rc);
}
예제 #6
0
static int
smb_fem_oplock_setattr(
    femarg_t		*arg,
    vattr_t		*vap,
    int			flags,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc = 0;

	if (ct != &smb_ct && (vap->va_mask & AT_SIZE) != 0)
		rc = smb_fem_oplock_break(arg, ct, SMB_OPLOCK_BREAK_TO_NONE);
	if (rc == 0)
		rc = vnext_setattr(arg, vap, flags, cr, ct);
	return (rc);
}
예제 #7
0
static int
smb_fem_oplock_space(
    femarg_t		*arg,
    int			cmd,
    flock64_t		*bfp,
    int			flag,
    offset_t		offset,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc;

	rc = smb_fem_oplock_break(arg, ct);
	if (rc == 0)
		rc = vnext_space(arg, cmd, bfp, flag, offset, cr, ct);
	return (rc);
}
예제 #8
0
static int
smb_fem_oplock_write(
    femarg_t		*arg,
    uio_t		*uiop,
    int			ioflag,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc = 0;

	if (ct != &smb_ct)
		rc = smb_fem_oplock_break(arg, ct, SMB_OPLOCK_BREAK_TO_NONE);
	if (rc == 0)
		rc = vnext_write(arg, uiop, ioflag, cr, ct);

	return (rc);
}
예제 #9
0
static int
smb_fem_oplock_space(
    femarg_t		*arg,
    int			cmd,
    flock64_t		*bfp,
    int			flag,
    offset_t		offset,
    cred_t		*cr,
    caller_context_t	*ct)
{
	int	rc = 0;

	if (ct != &smb_ct)
		rc = smb_fem_oplock_break(arg, ct, SMB_OPLOCK_BREAK_TO_NONE);
	if (rc == 0)
		rc = vnext_space(arg, cmd, bfp, flag, offset, cr, ct);
	return (rc);
}
예제 #10
0
static int
smb_fem_oplock_rwlock(
    femarg_t		*arg,
    int			write_lock,
    caller_context_t	*ct)
{
	uint32_t	flags;
	int		rc = 0;

	if (ct != &smb_ct) {
		if (write_lock)
			flags = SMB_OPLOCK_BREAK_TO_NONE;
		else
			flags = SMB_OPLOCK_BREAK_TO_LEVEL_II;
		rc = smb_fem_oplock_break(arg, ct, flags);
	}
	if (rc == 0)
		rc = vnext_rwlock(arg, write_lock, ct);

	return (rc);
}
예제 #11
0
/*
 * FEM oplock monitors
 *
 * The monitors below are not intended to intercept CIFS calls.
 * CIFS higher-level routines will break oplocks as needed prior
 * to getting to the VFS layer.
 */
static int
smb_fem_oplock_open(
    femarg_t		*arg,
    int			mode,
    cred_t		*cr,
    caller_context_t	*ct)
{
	uint32_t	flags;
	int		rc = 0;

	if (ct != &smb_ct) {
		if (mode & (FWRITE|FTRUNC))
			flags = SMB_OPLOCK_BREAK_TO_NONE;
		else
			flags = SMB_OPLOCK_BREAK_TO_LEVEL_II;
		rc = smb_fem_oplock_break(arg, ct, flags);
	}
	if (rc == 0)
		rc = vnext_open(arg, mode, cr, ct);

	return (rc);
}
예제 #12
0
static int
smb_fem_oplock_vnevent(
    femarg_t		*arg,
    vnevent_t		vnevent,
    vnode_t		*dvp,
    char		*name,
    caller_context_t	*ct)
{
	int	rc;

	switch (vnevent) {
	case VE_REMOVE:
	case VE_RENAME_DEST:
	case VE_RENAME_SRC:
		rc = smb_fem_oplock_break(arg, ct);
		if (rc != 0)
			return (rc);
		break;

	default:
		break;
	}
	return (vnext_vnevent(arg, vnevent, dvp, name, ct));
}