Alan's Blog

« CIFS Service Documen... | Main | Using Windows Previo... »
Friday Jan 09, 2009

Client-Side Caching for Offline Files

With the putback of PSARC 2008/758, the CIFS service provides per-share configuration options to support client-side caching (csc) for offline files, which can be set using sharemgr or zfs.  Note that client-side caching and offline files are managed entirely by clients, and the options discussed here provide per-share policy advice to clientsThe csc options are shown in below.

  • manual
    Clients are allowed to cache files from the specified share for offline use as requested by users but automatic file-by-file reintegration is not allowed.  This is the default setting.


  • auto
    Clients are allowed to automatically cache files from the specified share for offline use and file-by-file reintegration is allowed.


  • vdo
    Clients are allowed to automatically cache files from the specified share for offline use, file-by-file reintegration is allowed and clients are permitted to work from their local cache
    even while offline.
  • disabled
    Client-side caching is disabled for this share.

First, we need to create a file system and share it.  For use with SMB/CIFS, it's best to create a mixed-mode zfs file system.  If you have both NFS and SMB clients using a mixture of different character sets on the same file system you may also want to set utf8only and consider the charset=<access-list> NFS share property that Doug described in a recent blog entry.

        zfs create -o casesensitivity=mixed -o utf8only=on tank/zvol
        zfs sharesmb=name=zvol tank/zvol

        sharemgr show -vp
        default nfs=()
        zfs
            zfs/tank/zvol smb=()
                zvol=/tank/zvol

The default, when no specific csc option has been set, is equivalent to csc=manual.

Since this share is a member of the zfs group, share options such as client-side caching must be set using the zfs command.  In the following example the csc option is set to auto.

        zfs sharesmb=name=zvol,csc=auto tank/zvol

        sharemgr show -vp
        default nfs=()
        zfs
            zfs/tank/zvol          smb=(csc="auto")
                zvol=/tank/zvol

Note: The zfs command interprets sharesmb as a property with a single value, even though that value may contain a list of share properties.  When using the zfs command to set share options, all desired share options must be set each time the property is set or modified - as illustrated above.  Failure to do this may result in share properties being unset.  For example, after the two commands below, the share name would be tank_zvol rather than zvol.

zfs sharesmb=name=zvol tank/zvol
zfs sharesmb=csc=auto tank/zvol
<-- resets the share name to
tank_zvol

Alternatively, we can use sharemgr's default group or create our own group.  In this example, we add a share to zgroup and disable client-side caching for that share.

        sharemgr create -P smb zgroup
        sharemgr add-share -r zvol2 -s /tank/zvol2 zgroup
        sharemgr set -P smb -p csc=disabled -r zvol2 zgroup

        sharemgr show -vp
        default nfs=()
        zfs
            zfs/tank/zvol          smb=(csc="auto")
                zvol=/tank/zvol
        zgroup smb=()
            /tank/zvol2
                zvol2=/tank/zvol2  smb=(csc="disabled")

Note that, as illustrated above, the csc setting is per-share.

The csc options are also valid for autohome shares in the smbautohome map.  As with zfs sharesmb, multiple options can be specified as a comma separated list.  For example,

        *      /export/home/&   csc=disabled,description=&
        john   /export/home/&   csc=auto,dn=sun,dn=com,ou=users

Some useful links for managing offline files on Windows:

Comments:

Hi, it won't work for me. Am I missing something here?

~# uname -vs
SunOS snv_105
~# zfs sharesmb=name=danny$,csc=auto R500/danny
cannot set property for 'R500/danny': 'sharesmb' cannot be set to invalid options

~# zpool upgrade
This system is currently running ZFS pool version 14.

The following pools are out of date, and can be upgraded. After being
upgraded, these pools will no longer be accessible by older software versions.

VER POOL
--- ------------
13 rpool

Posted by Danny on January 17, 2009 at 05:08 PM PST #

I don't think this is available in snv_105.
Using snv_106:

# zfs sharesmb=name=danny$,csc=auto tank2/zvol2
# sharemgr show -vp
default nfs=()
zfs
zfs/tank2/zvol2 smb=()
/tank2/zvol2
danny$=/tank2/zvol2 smb=(csc="auto")

Posted by Alan Wright on January 18, 2009 at 10:31 PM PST #

Post a Comment:
Comments are closed for this entry.