Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_subr2.c
          +++ new/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_subr2.c
↓ open down ↓ 149 lines elided ↑ open up ↑
 150  150   *
 151  151   * NFS: nfs_subr.c:rinactive
 152  152   */
 153  153  static void
 154  154  sn_inactive(smbnode_t *np)
 155  155  {
 156  156          vsecattr_t      ovsa;
 157  157          cred_t          *oldcr;
 158  158          char            *orpath;
 159  159          int             orplen;
      160 +        vnode_t         *vp;
 160  161  
 161  162          /*
 162      -         * Flush and invalidate all pages (todo)
      163 +         * Flush and invalidate all pages
 163  164           * Free any held credentials and caches...
 164  165           * etc.  (See NFS code)
 165  166           */
 166  167          mutex_enter(&np->r_statelock);
 167  168  
 168  169          ovsa = np->r_secattr;
 169  170          np->r_secattr = smbfs_vsa0;
 170  171          np->r_sectime = 0;
 171  172  
 172  173          oldcr = np->r_cred;
 173  174          np->r_cred = NULL;
 174  175  
 175  176          orpath = np->n_rpath;
 176  177          orplen = np->n_rplen;
 177  178          np->n_rpath = NULL;
 178  179          np->n_rplen = 0;
 179  180  
 180  181          mutex_exit(&np->r_statelock);
 181  182  
      183 +        vp = SMBTOV(np);
      184 +        if (vn_has_cached_data(vp)) {
      185 +                smbfs_invalidate_pages(vp, (u_offset_t) 0, oldcr);
      186 +        }
      187 +
 182  188          if (ovsa.vsa_aclentp != NULL)
 183  189                  kmem_free(ovsa.vsa_aclentp, ovsa.vsa_aclentsz);
 184  190  
 185  191          if (oldcr != NULL)
 186  192                  crfree(oldcr);
 187  193  
 188  194          if (orpath != NULL)
 189  195                  kmem_free(orpath, orplen + 1);
 190  196  }
 191  197  
↓ open down ↓ 841 lines elided ↑ open up ↑
1033 1039          kmem_cache_free(smbnode_cache, np);
1034 1040          VFS_RELE(vfsp);
1035 1041  }
1036 1042  
1037 1043  /*
1038 1044   * Flush all vnodes in this (or every) vfs.
1039 1045   * Used by nfs_sync and by nfs_unmount.
1040 1046   */
1041 1047  /*ARGSUSED*/
1042 1048  void
1043      -smbfs_rflush(struct vfs *vfsp, cred_t *cr)
1044      -{
1045      -        /* Todo: mmap support. */
     1049 +smbfs_rflush(struct vfs *vfsp, cred_t *cr) {
     1050 +
     1051 +    smbmntinfo_t *mi;
     1052 +    smbnode_t *np;
     1053 +    vnode_t *vp;
     1054 +
     1055 +    long num, cnt;
     1056 +
     1057 +    vnode_t **vplist;
     1058 +
     1059 +    mi = VFTOSMI(vfsp);
     1060 +
     1061 +    cnt = 0;
     1062 +    num = mi->smi_hash_avl.avl_numnodes;
     1063 +    vplist = kmem_alloc(num * sizeof (vnode_t*), KM_SLEEP);
     1064 +
     1065 +    rw_enter(&mi->smi_hash_lk, RW_READER);
     1066 +    for (np = avl_first(&mi->smi_hash_avl); np != NULL;
     1067 +            np = avl_walk(&mi->smi_hash_avl, np, AVL_AFTER)) {
     1068 +        vp = SMBTOV(np);
     1069 +        if (vn_is_readonly(vp))
     1070 +            continue;
     1071 +
     1072 +        if (vn_has_cached_data(vp) && (np->r_flags & RDIRTY || np->r_mapcnt > 0)) {
     1073 +            VN_HOLD(vp);
     1074 +            vplist[cnt++] = vp;
     1075 +            if (cnt == num)
     1076 +                break;
     1077 +        }
     1078 +    }
     1079 +    rw_exit(&mi->smi_hash_lk);
     1080 +
     1081 +    while (cnt-- > 0) {
     1082 +        vp = vplist[cnt];
     1083 +        (void) VOP_PUTPAGE(vp, 0, 0, 0, cr, NULL);
     1084 +        VN_RELE(vp);
     1085 +    }
     1086 +
     1087 +    kmem_free(vplist, num * sizeof (vnode_t*));
1046 1088  }
1047 1089  
1048 1090  /* access cache */
1049 1091  /* client handles */
1050 1092  
1051 1093  /*
1052 1094   * initialize resources that are used by smbfs_subr.c
1053 1095   * this is called from the _init() routine (by the way of smbfs_clntinit())
1054 1096   *
1055 1097   * NFS: nfs_subr.c:nfs_subrinit
↓ open down ↓ 120 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX