Print this page
5404 smbfs needs mmap support
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c
          +++ new/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c
↓ open down ↓ 873 lines elided ↑ open up ↑
 874  874           * Copy the statvfs data to caller's buf.
 875  875           * Note: struct assignment
 876  876           */
 877  877  cache_hit:
 878  878          if (error == 0)
 879  879                  *sbp = smi->smi_statvfsbuf;
 880  880          mutex_exit(&smi->smi_lock);
 881  881          return (error);
 882  882  }
 883  883  
 884      -static kmutex_t smbfs_syncbusy;
 885      -
 886  884  /*
 887  885   * Flush dirty smbfs files for file system vfsp.
 888  886   * If vfsp == NULL, all smbfs files are flushed.
 889  887   */
 890  888  /*ARGSUSED*/
 891  889  static int
 892  890  smbfs_sync(vfs_t *vfsp, short flag, cred_t *cr)
 893  891  {
      892 +
 894  893          /*
 895      -         * Cross-zone calls are OK here, since this translates to a
 896      -         * VOP_PUTPAGE(B_ASYNC), which gets picked up by the right zone.
      894 +         * SYNC_ATTR is used by fsflush() to force old filesystems like UFS
      895 +         * to sync metadata, which they would otherwise cache indefinitely.
      896 +         * Semantically, the only requirement is that the sync be initiated.
      897 +         * Assume the server-side takes care of attribute sync.
 897  898           */
 898      -        if (!(flag & SYNC_ATTR) && mutex_tryenter(&smbfs_syncbusy) != 0) {
 899      -                smbfs_rflush(vfsp, cr);
 900      -                mutex_exit(&smbfs_syncbusy);
      899 +        if (flag & SYNC_ATTR)
      900 +                return (0);
      901 +
      902 +        if (vfsp == NULL) {
      903 +                /*
      904 +                 * Flush ALL smbfs mounts in this zone.
      905 +                 */
      906 +                smbfs_flushall(cr);
      907 +                return (0);
 901  908          }
 902  909  
      910 +        smbfs_rflush(vfsp, cr);
      911 +
 903  912          return (0);
 904  913  }
 905  914  
 906  915  /*
 907  916   * Initialization routine for VFS routines.  Should only be called once
 908  917   */
 909  918  int
 910  919  smbfs_vfsinit(void)
 911  920  {
 912      -        mutex_init(&smbfs_syncbusy, NULL, MUTEX_DEFAULT, NULL);
 913  921          return (0);
 914  922  }
 915  923  
 916  924  /*
 917  925   * Shutdown routine for VFS routines.  Should only be called once
 918  926   */
 919  927  void
 920  928  smbfs_vfsfini(void)
 921  929  {
 922      -        mutex_destroy(&smbfs_syncbusy);
 923  930  }
 924  931  
 925  932  void
 926  933  smbfs_freevfs(vfs_t *vfsp)
 927  934  {
 928  935          smbmntinfo_t    *smi;
 929  936  
 930  937          /* free up the resources */
 931  938          smi = VFTOSMI(vfsp);
 932  939  
↓ open down ↓ 107 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX