diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2008-04-16 11:33:32 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2008-04-16 11:33:32 +0000 |
commit | eab626f110908f209587469de08f63bf8642aa68 (patch) | |
tree | 8616e51dd9b0325c0f52f09db6fcfd6bd22753bc /sys/fs/smbfs | |
parent | 92c4ddb268353053b8e7302a8eaa3b4a486127dd (diff) | |
download | src-eab626f110908f209587469de08f63bf8642aa68.tar.gz src-eab626f110908f209587469de08f63bf8642aa68.zip |
Move the head of byte-level advisory lock list from the
filesystem-specific vnode data to the struct vnode. Provide the
default implementation for the vop_advlock and vop_advlockasync.
Purge the locks on the vnode reclaim by using the lf_purgelocks().
The default implementation is augmented for the nfs and smbfs.
In the nfs_advlock, push the Giant inside the nfs_dolock.
Before the change, the vop_advlock and vop_advlockasync have taken the
unlocked vnode and dereferenced the fs-private inode data, racing with
with the vnode reclamation due to forced unmount. Now, the vop_getattr
under the shared vnode lock is used to obtain the inode size, and
later, in the lf_advlockasync, after locking the vnode interlock, the
VI_DOOMED flag is checked to prevent an operation on the doomed vnode.
The implementation of the lf_purgelocks() is submitted by dfr.
Reported by: kris
Tested by: kris, pho
Discussed with: jeff, dfr
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=178243
Diffstat (limited to 'sys/fs/smbfs')
-rw-r--r-- | sys/fs/smbfs/smbfs_node.h | 1 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/sys/fs/smbfs/smbfs_node.h b/sys/fs/smbfs/smbfs_node.h index 4e923936adbb..f9c08cf76f64 100644 --- a/sys/fs/smbfs/smbfs_node.h +++ b/sys/fs/smbfs/smbfs_node.h @@ -66,7 +66,6 @@ struct smbnode { u_char * n_name; struct smbfs_fctx * n_dirseq; /* ff context */ long n_dirofs; /* last ff offset */ - struct lockf * n_lockf; /* Locking records of file */ LIST_ENTRY(smbnode) n_hash; }; diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 4d5f454abf21..f7ca8062806d 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -1008,7 +1008,7 @@ smbfs_advlock(ap) default: return EINVAL; } - error = lf_advlock(ap, &np->n_lockf, size); + error = lf_advlock(ap, &vp->v_lockf, size); if (error) break; lkop = SMB_LOCK_EXCL; @@ -1017,16 +1017,16 @@ smbfs_advlock(ap) int oldtype = fl->l_type; fl->l_type = F_UNLCK; ap->a_op = F_UNLCK; - lf_advlock(ap, &np->n_lockf, size); + lf_advlock(ap, &vp->v_lockf, size); fl->l_type = oldtype; } break; case F_UNLCK: - lf_advlock(ap, &np->n_lockf, size); + lf_advlock(ap, &vp->v_lockf, size); error = smbfs_smb_lock(np, SMB_LOCK_RELEASE, id, start, end, &scred); break; case F_GETLK: - error = lf_advlock(ap, &np->n_lockf, size); + error = lf_advlock(ap, &vp->v_lockf, size); break; default: return EINVAL; |