Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107370325
D32999.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D32999.diff
View Options
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -647,6 +647,11 @@
NFSLOCKNODE(np);
if (np->n_flag & NMODIFIED) {
NFSUNLOCKNODE(np);
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp))
+ return (EBADF);
+ }
error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
if (error == EINTR || error == EIO) {
if (NFS_ISV4(vp))
@@ -683,6 +688,11 @@
if (vp->v_type == VDIR)
np->n_direofoffset = 0;
NFSUNLOCKNODE(np);
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp))
+ return (EBADF);
+ }
error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
if (error == EINTR || error == EIO) {
if (NFS_ISV4(vp))
@@ -703,6 +713,11 @@
(vp->v_type == VREG)) {
if (np->n_directio_opens == 0) {
NFSUNLOCKNODE(np);
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp))
+ return (EBADF);
+ }
error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
if (error) {
if (NFS_ISV4(vp))
@@ -748,6 +763,11 @@
if (vp->v_writecount <= -1) {
if ((obj = vp->v_object) != NULL &&
vm_object_mightbedirty(obj)) {
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp))
+ return (EBADF);
+ }
VM_OBJECT_WLOCK(obj);
vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
VM_OBJECT_WUNLOCK(obj);
@@ -831,6 +851,11 @@
* mmap'ed writes or via write().
*/
if (nfs_clean_pages_on_close && vp->v_object) {
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp) && ap->a_fflag != FNONBLOCK)
+ return (EBADF);
+ }
VM_OBJECT_WLOCK(vp->v_object);
vm_object_page_clean(vp->v_object, 0, 0, 0);
VM_OBJECT_WUNLOCK(vp->v_object);
@@ -855,11 +880,22 @@
* traditional vnode locking implemented for Vnode Ops.
*/
int cm = newnfs_commit_on_close ? 1 : 0;
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp) && ap->a_fflag != FNONBLOCK)
+ return (EBADF);
+ }
error = ncl_flush(vp, MNT_WAIT, ap->a_td, cm, 0);
/* np->n_flag &= ~NMODIFIED; */
} else if (NFS_ISV4(vp)) {
if (nfscl_mustflush(vp) != 0) {
int cm = newnfs_commit_on_close ? 1 : 0;
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp) && ap->a_fflag !=
+ FNONBLOCK)
+ return (EBADF);
+ }
error = ncl_flush(vp, MNT_WAIT, ap->a_td,
cm, 0);
/*
@@ -869,6 +905,12 @@
*/
}
} else {
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
+ if (VN_IS_DOOMED(vp) && ap->a_fflag !=
+ FNONBLOCK)
+ return (EBADF);
+ }
error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
}
NFSLOCKNODE(np);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 14, 4:30 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15791013
Default Alt Text
D32999.diff (3 KB)
Attached To
Mode
D32999: nfsclient: upgrade vnode lock in VOP_OPEN() if we need to flush buffers
Attached
Detach File
Event Timeline
Log In to Comment