s3:vfs_tsmsm only send notifications when file was offline before
authorChristian Ambach <ambi@samba.org>
Fri, 17 Aug 2012 15:40:24 +0000 (17:40 +0200)
committerChristian Ambach <ambi@samba.org>
Fri, 17 Aug 2012 18:05:30 +0000 (20:05 +0200)
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Fri Aug 17 20:05:30 CEST 2012 on sn-devel-104

source3/modules/vfs_tsmsm.c

index db9df25a9069ee2d3be41ff78ca3b320bcec2dde..e4bc7eb45414122776c935b6fe463ea5b3170bd8 100644 (file)
@@ -290,6 +290,7 @@ struct tsmsm_pread_state {
        struct files_struct *fsp;
        ssize_t ret;
        int err;
+       bool was_offline;
 };
 
 static void tsmsm_pread_done(struct tevent_req *subreq);
@@ -308,6 +309,7 @@ static struct tevent_req *tsmsm_pread_send(struct vfs_handle_struct *handle,
                return NULL;
        }
        state->fsp = fsp;
+       state->was_offline = tsmsm_aio_force(handle, fsp);
        subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
                                         n, offset);
        if (tevent_req_nomem(subreq, req)) {
@@ -337,7 +339,7 @@ static ssize_t tsmsm_pread_recv(struct tevent_req *req, int *err)
        if (tevent_req_is_unix_error(req, err)) {
                return -1;
        }
-       if (state->ret >= 0) {
+       if (state->ret >= 0 && state->was_offline) {
                struct files_struct *fsp = state->fsp;
                notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
                             FILE_NOTIFY_CHANGE_ATTRIBUTES,
@@ -351,6 +353,7 @@ struct tsmsm_pwrite_state {
        struct files_struct *fsp;
        ssize_t ret;
        int err;
+       bool was_offline;
 };
 
 static void tsmsm_pwrite_done(struct tevent_req *subreq);
@@ -370,6 +373,7 @@ static struct tevent_req *tsmsm_pwrite_send(struct vfs_handle_struct *handle,
                return NULL;
        }
        state->fsp = fsp;
+       state->was_offline = tsmsm_aio_force(handle, fsp);
        subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
                                          n, offset);
        if (tevent_req_nomem(subreq, req)) {
@@ -399,7 +403,7 @@ static ssize_t tsmsm_pwrite_recv(struct tevent_req *req, int *err)
        if (tevent_req_is_unix_error(req, err)) {
                return -1;
        }
-       if (state->ret >= 0) {
+       if (state->ret >= 0 && state->was_offline) {
                struct files_struct *fsp = state->fsp;
                notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
                             FILE_NOTIFY_CHANGE_ATTRIBUTES,