Lines 3008-3021
nfs_advlock(struct vop_advlock_args *ap)
Link Here
|
3008 |
int ret, error = EOPNOTSUPP; |
3008 |
int ret, error = EOPNOTSUPP; |
3009 |
u_quad_t size; |
3009 |
u_quad_t size; |
3010 |
|
3010 |
|
|
|
3011 |
ret = NFSVOPLOCK(vp, LK_SHARED); |
3012 |
if (ret != 0) |
3013 |
return (EBADF); |
3011 |
if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { |
3014 |
if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { |
3012 |
if (vp->v_type != VREG) |
3015 |
if (vp->v_type != VREG) { |
|
|
3016 |
NFSVOPUNLOCK(vp, 0); |
3013 |
return (EINVAL); |
3017 |
return (EINVAL); |
|
|
3018 |
} |
3014 |
if ((ap->a_flags & F_POSIX) != 0) |
3019 |
if ((ap->a_flags & F_POSIX) != 0) |
3015 |
cred = p->p_ucred; |
3020 |
cred = p->p_ucred; |
3016 |
else |
3021 |
else |
3017 |
cred = td->td_ucred; |
3022 |
cred = td->td_ucred; |
3018 |
NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); |
3023 |
NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY); |
3019 |
if (vp->v_iflag & VI_DOOMED) { |
3024 |
if (vp->v_iflag & VI_DOOMED) { |
3020 |
NFSVOPUNLOCK(vp, 0); |
3025 |
NFSVOPUNLOCK(vp, 0); |
3021 |
return (EBADF); |
3026 |
return (EBADF); |
Lines 3094-3102
nfs_advlock(struct vop_advlock_args *ap)
Link Here
|
3094 |
NFSVOPUNLOCK(vp, 0); |
3099 |
NFSVOPUNLOCK(vp, 0); |
3095 |
return (0); |
3100 |
return (0); |
3096 |
} else if (!NFS_ISV4(vp)) { |
3101 |
} else if (!NFS_ISV4(vp)) { |
3097 |
error = NFSVOPLOCK(vp, LK_SHARED); |
|
|
3098 |
if (error) |
3099 |
return (error); |
3100 |
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { |
3102 |
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { |
3101 |
size = VTONFS(vp)->n_size; |
3103 |
size = VTONFS(vp)->n_size; |
3102 |
NFSVOPUNLOCK(vp, 0); |
3104 |
NFSVOPUNLOCK(vp, 0); |
Lines 3119-3125
nfs_advlock(struct vop_advlock_args *ap)
Link Here
|
3119 |
NFSVOPUNLOCK(vp, 0); |
3121 |
NFSVOPUNLOCK(vp, 0); |
3120 |
} |
3122 |
} |
3121 |
} |
3123 |
} |
3122 |
} |
3124 |
} else |
|
|
3125 |
NFSVOPUNLOCK(vp, 0); |
3123 |
return (error); |
3126 |
return (error); |
3124 |
} |
3127 |
} |
3125 |
|
3128 |
|