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 ↓ 836 lines elided ↑ open up ↑
1028 1034          ASSERT(!(np->r_flags & RHASHED));
1029 1035          ASSERT(np->r_freef == NULL && np->r_freeb == NULL);
1030 1036          atomic_add_long((ulong_t *)&smbnodenew, -1);
1031 1037          vn_invalid(vp);
1032 1038          vn_free(vp);
1033 1039          kmem_cache_free(smbnode_cache, np);
1034 1040          VFS_RELE(vfsp);
1035 1041  }
1036 1042  
1037 1043  /*
     1044 + * Correspond to rflush() in NFS.
1038 1045   * Flush all vnodes in this (or every) vfs.
1039      - * Used by nfs_sync and by nfs_unmount.
     1046 + * Used by smbfs_sync and by smbfs_unmount.
1040 1047   */
1041 1048  /*ARGSUSED*/
1042 1049  void
1043      -smbfs_rflush(struct vfs *vfsp, cred_t *cr)
1044      -{
1045      -        /* Todo: mmap support. */
     1050 +smbfs_rflush(struct vfs *vfsp, cred_t *cr) {
     1051 +
     1052 +    smbmntinfo_t *mi;
     1053 +    smbnode_t *np;
     1054 +    vnode_t *vp;
     1055 +
     1056 +    long num, cnt;
     1057 +
     1058 +    vnode_t **vplist;
     1059 +
     1060 +    if(vfsp == NULL)
     1061 +        return;
     1062 +
     1063 +    mi = VFTOSMI(vfsp);
     1064 +
     1065 +    cnt = 0;
     1066 +
     1067 +    num = mi->smi_hash_avl.avl_numnodes;
     1068 +
     1069 +    vplist = kmem_alloc(num * sizeof (vnode_t*), KM_SLEEP);
     1070 +
     1071 +    rw_enter(&mi->smi_hash_lk, RW_READER);
     1072 +    for (np = avl_first(&mi->smi_hash_avl); np != NULL;
     1073 +            np = avl_walk(&mi->smi_hash_avl, np, AVL_AFTER)) {
     1074 +        vp = SMBTOV(np);
     1075 +        if (vn_is_readonly(vp))
     1076 +            continue;
     1077 +
     1078 +        if (vn_has_cached_data(vp) && (np->r_flags & RDIRTY || np->r_mapcnt > 0)) {
     1079 +            VN_HOLD(vp);
     1080 +            vplist[cnt++] = vp;
     1081 +            if (cnt == num)
     1082 +                break;
     1083 +        }
     1084 +    }
     1085 +    rw_exit(&mi->smi_hash_lk);
     1086 +
     1087 +    while (cnt-- > 0) {
     1088 +        vp = vplist[cnt];
     1089 +        (void) VOP_PUTPAGE(vp, 0, 0, 0, cr, NULL);
     1090 +        VN_RELE(vp);
     1091 +    }
     1092 +
     1093 +    kmem_free(vplist, num * sizeof (vnode_t*));
1046 1094  }
1047 1095  
1048 1096  /* access cache */
1049 1097  /* client handles */
1050 1098  
1051 1099  /*
1052 1100   * initialize resources that are used by smbfs_subr.c
1053 1101   * this is called from the _init() routine (by the way of smbfs_clntinit())
1054 1102   *
1055 1103   * NFS: nfs_subr.c:nfs_subrinit
↓ open down ↓ 120 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX