s3:modules/vfs_gpfs add gpfs:recalls option
authorChristian Ambach <ambi@samba.org>
Wed, 20 Mar 2013 14:16:37 +0000 (15:16 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 14 Mar 2014 09:45:10 +0000 (10:45 +0100)
When this option is set to no, an attempt to open an offline file will
be rejected with access denied.  This helps preventing recall storms
triggered by careless applications like Finder and Explorer.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_gpfs.c

index 760d27fb5ccea90dbc92fe84e293532418a12aae..73ab4a463d9655dab4812148c0b8d48797a2f15d 100644 (file)
@@ -49,6 +49,7 @@ struct gpfs_config_data {
        bool prealloc;
        bool acl;
        bool settimes;
+       bool recalls;
 };
 
 
@@ -1810,6 +1811,8 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle,
 
        config->settimes = lp_parm_bool(SNUM(handle->conn), "gpfs",
                                        "settimes", true);
+       config->recalls = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                      "recalls", true);
 
        SMB_VFS_HANDLE_SET_DATA(handle, config,
                                NULL, struct gpfs_config_data,
@@ -2015,6 +2018,16 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
                                struct gpfs_config_data,
                                return -1);
 
+       if (config->hsm && !config->recalls) {
+               if (VALID_STAT(smb_fname->st) &&
+                   (smb_fname->st.vfs_private & GPFS_WINATTR_OFFLINE)) {
+                       DEBUG(10, ("Refusing access to offline file %s\n",
+                                 fsp_str_dbg(fsp)));
+                       errno = EACCES;
+                       return -1;
+               }
+       }
+
        if (config->syncio) {
                flags |= O_SYNC;
        }