summaryrefslogtreecommitdiffstats
path: root/source3/modules/vfs_gpfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules/vfs_gpfs.c')
-rw-r--r--source3/modules/vfs_gpfs.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 9fcce78a68..8049cb779b 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1848,7 +1848,8 @@ 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 ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0) {
+ if (SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name, &fsp->fsp_name->st))
+ {
errno = ENOSYS;
return -1;
}
@@ -2115,8 +2116,8 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
return -1);
if (config->hsm && !config->recalls) {
- if (VALID_STAT(smb_fname->st) &&
- (smb_fname->st.vfs_private & GPFS_WINATTR_OFFLINE)) {
+ 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;
@@ -2134,14 +2135,14 @@ static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
void *data, size_t n, off_t offset)
{
ssize_t ret;
+ bool was_offline;
- ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+ was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+ &fsp->fsp_name->st);
- DEBUG(10, ("vfs_private = %x\n",
- (unsigned int)fsp->fsp_name->st.vfs_private));
+ ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
- if ((ret != -1) &&
- ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ if ((ret != -1) && was_offline) {
fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_ATTRIBUTES,
@@ -2155,6 +2156,7 @@ struct vfs_gpfs_pread_state {
struct files_struct *fsp;
ssize_t ret;
int err;
+ bool was_offline;
};
static void vfs_gpfs_pread_done(struct tevent_req *subreq);
@@ -2173,6 +2175,8 @@ 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->fsp = fsp;
subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
n, offset);
@@ -2206,11 +2210,7 @@ static ssize_t vfs_gpfs_pread_recv(struct tevent_req *req, int *err)
}
*err = state->err;
- DEBUG(10, ("vfs_private = %x\n",
- (unsigned int)fsp->fsp_name->st.vfs_private));
-
- if ((state->ret != -1) &&
- ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ if ((state->ret != -1) && state->was_offline) {
fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
DEBUG(10, ("sending notify\n"));
notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
@@ -2225,14 +2225,14 @@ static ssize_t vfs_gpfs_pwrite(vfs_handle_struct *handle, files_struct *fsp,
const void *data, size_t n, off_t offset)
{
ssize_t ret;
+ bool was_offline;
- ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+ was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+ &fsp->fsp_name->st);
- DEBUG(10, ("vfs_private = %x\n",
- (unsigned int)fsp->fsp_name->st.vfs_private));
+ ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
- if ((ret != -1) &&
- ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ if ((ret != -1) && was_offline) {
fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_ATTRIBUTES,
@@ -2246,6 +2246,7 @@ struct vfs_gpfs_pwrite_state {
struct files_struct *fsp;
ssize_t ret;
int err;
+ bool was_offline;
};
static void vfs_gpfs_pwrite_done(struct tevent_req *subreq);
@@ -2265,6 +2266,8 @@ 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->fsp = fsp;
subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
n, offset);
@@ -2298,11 +2301,7 @@ static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req, int *err)
}
*err = state->err;
- DEBUG(10, ("vfs_private = %x\n",
- (unsigned int)fsp->fsp_name->st.vfs_private));
-
- if ((state->ret != -1) &&
- ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+ if ((state->ret != -1) && state->was_offline) {
fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
DEBUG(10, ("sending notify\n"));
notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,