Author: kib
Date: Mon Sep 16 13:26:27 2019
New Revision: 352393
URL: https://svnweb.freebsd.org/changeset/base/352393

Log:
  nfscl_loadattrcache: fix rest of the cases to not call
  vnode_pager_setsize() under the node mutex.
  
  r248567 moved some calls of vnode_pager_setsize() after the node lock
  is unlocked, do the rest now.
  
  Reported and tested by:       peterj
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/fs/nfsclient/nfs_clport.c

Modified: head/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clport.c  Mon Sep 16 13:10:34 2019        
(r352392)
+++ head/sys/fs/nfsclient/nfs_clport.c  Mon Sep 16 13:26:27 2019        
(r352393)
@@ -511,10 +511,10 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
                                 * zero np->n_attrstamp to indicate that
                                 * the attributes are stale.
                                 */
-                               vap->va_size = np->n_size;
+                               nsize = vap->va_size = np->n_size;
+                               setnsize = 1;
                                np->n_attrstamp = 0;
                                KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
-                               vnode_pager_setsize(vp, np->n_size);
                        } else if (np->n_flag & NMODIFIED) {
                                /*
                                 * We've modified the file: Use the larger
@@ -526,7 +526,8 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
                                        np->n_size = vap->va_size;
                                        np->n_flag |= NSIZECHANGED;
                                }
-                               vnode_pager_setsize(vp, np->n_size);
+                               nsize = np->n_size;
+                               setnsize = 1;
                        } else if (vap->va_size < np->n_size) {
                                /*
                                 * When shrinking the size, the call to
@@ -538,9 +539,9 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
                                np->n_flag |= NSIZECHANGED;
                                setnsize = 1;
                        } else {
-                               np->n_size = vap->va_size;
+                               nsize = np->n_size = vap->va_size;
                                np->n_flag |= NSIZECHANGED;
-                               vnode_pager_setsize(vp, np->n_size);
+                               setnsize = 1;
                        }
                } else {
                        np->n_size = vap->va_size;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to