[SCM] Samba Shared Repository - branch master updated
Christof Schmitt
cs at samba.org
Fri Sep 4 23:51:02 UTC 2015
The branch, master has been updated
via 2a8b21e vfs_gpfs: Avoid calling gpfs_is_offline on every i/o
via 53a8cc7 vfs_gpfs: Introduce vfs_gpfs_fsp_is_offline
from 0fb8ea7 winbind: Don't delete an existing krb5 ticket on cached logon.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2a8b21e5ae7e90f63c2fb87a7c747d8d1fc2c01e
Author: Volker Lendecke <vl at samba.org>
Date: Wed Sep 2 13:20:08 2015 +0200
vfs_gpfs: Avoid calling gpfs_is_offline on every i/o
Asks gpfs as long as a file is offline. Once it was reported online once,
we'll not ask anymore. This assumes that while we have a file open it
won't be migrated away. This might not *always* be true, but probably
close enough. And as long as we don't have a proper notification mechanism
and as long as polling is too expensive, this seems like a good strategy.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Sat Sep 5 01:50:09 CEST 2015 on sn-devel-104
commit 53a8cc7c0df37d68270a9e1877c14d40e96abf53
Author: Volker Lendecke <vl at samba.org>
Date: Thu Sep 3 12:10:35 2015 +0200
vfs_gpfs: Introduce vfs_gpfs_fsp_is_offline
This consolidates a few common calls
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_gpfs.c | 81 ++++++++++++++++++++++++++++++++++------------
1 file changed, 61 insertions(+), 20 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 3e593e1..ee4c1f6 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -54,6 +54,10 @@ struct gpfs_config_data {
bool recalls;
};
+struct gpfs_fsp_extension {
+ bool offline;
+};
+
static inline unsigned int gpfs_acl_flags(gpfs_acl_t *gacl)
{
if (gacl->acl_level == GPFS_ACL_LEVEL_V4FLAGS) {
@@ -1955,18 +1959,42 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
}
+static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle,
+ struct files_struct *fsp)
+{
+ struct gpfs_fsp_extension *ext;
+
+ ext = VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ if (ext == NULL) {
+ /*
+ * Something bad happened, always ask.
+ */
+ return vfs_gpfs_is_offline(handle, fsp->fsp_name,
+ &fsp->fsp_name->st);
+ }
+
+ if (ext->offline) {
+ /*
+ * As long as it's offline, ask.
+ */
+ ext->offline = vfs_gpfs_is_offline(handle, fsp->fsp_name,
+ &fsp->fsp_name->st);
+ }
+
+ return ext->offline;
+}
+
static bool vfs_gpfs_aio_force(struct vfs_handle_struct *handle,
struct files_struct *fsp)
{
- return vfs_gpfs_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
+ return vfs_gpfs_fsp_is_offline(handle, fsp);
}
static ssize_t vfs_gpfs_sendfile(vfs_handle_struct *handle, int tofd,
files_struct *fsp, const DATA_BLOB *hdr,
off_t offset, size_t n)
{
- if (SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name, &fsp->fsp_name->st))
- {
+ if (vfs_gpfs_fsp_is_offline(handle, fsp)) {
errno = ENOSYS;
return -1;
}
@@ -2202,25 +2230,42 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
int flags, mode_t mode)
{
struct gpfs_config_data *config;
+ int ret;
+ struct gpfs_fsp_extension *ext;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct gpfs_config_data,
return -1);
- if (config->hsm && !config->recalls) {
- if (SMB_VFS_IS_OFFLINE(handle->conn, smb_fname, &smb_fname->st))
- {
- DEBUG(10, ("Refusing access to offline file %s\n",
- fsp_str_dbg(fsp)));
- errno = EACCES;
- return -1;
- }
+ if (config->hsm && !config->recalls &&
+ vfs_gpfs_fsp_is_offline(handle, fsp)) {
+ DEBUG(10, ("Refusing access to offline file %s\n",
+ fsp_str_dbg(fsp)));
+ errno = EACCES;
+ return -1;
}
if (config->syncio) {
flags |= O_SYNC;
}
- return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+
+ ext = VFS_ADD_FSP_EXTENSION(handle, fsp, struct gpfs_fsp_extension,
+ NULL);
+ if (ext == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ /*
+ * Assume the file is offline until gpfs tells us it's online.
+ */
+ *ext = (struct gpfs_fsp_extension) { .offline = true };
+
+ ret = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+ if (ret == -1) {
+ VFS_REMOVE_FSP_EXTENSION(handle, fsp);
+ }
+ return ret;
}
static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
@@ -2229,8 +2274,7 @@ static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
ssize_t ret;
bool was_offline;
- was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
- &fsp->fsp_name->st);
+ was_offline = vfs_gpfs_fsp_is_offline(handle, fsp);
ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
@@ -2266,8 +2310,7 @@ static struct tevent_req *vfs_gpfs_pread_send(struct vfs_handle_struct *handle,
if (req == NULL) {
return NULL;
}
- state->was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
- &fsp->fsp_name->st);
+ state->was_offline = vfs_gpfs_fsp_is_offline(handle, fsp);
state->fsp = fsp;
subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
n, offset);
@@ -2317,8 +2360,7 @@ static ssize_t vfs_gpfs_pwrite(vfs_handle_struct *handle, files_struct *fsp,
ssize_t ret;
bool was_offline;
- was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
- &fsp->fsp_name->st);
+ was_offline = vfs_gpfs_fsp_is_offline(handle, fsp);
ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
@@ -2355,8 +2397,7 @@ static struct tevent_req *vfs_gpfs_pwrite_send(
if (req == NULL) {
return NULL;
}
- state->was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
- &fsp->fsp_name->st);
+ state->was_offline = vfs_gpfs_fsp_is_offline(handle, fsp);
state->fsp = fsp;
subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
n, offset);
--
Samba Shared Repository
More information about the samba-cvs
mailing list