From: Ralph Boehme Date: Thu, 2 Apr 2020 13:37:15 +0000 (+0200) Subject: smbd: move files_struct.update_write_time_on_close to a bitfield X-Git-Tag: ldb-2.2.0~996 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c2809c51756b9a92e1939ee388bec5108b00ef2;p=thirdparty%2Fsamba.git smbd: move files_struct.update_write_time_on_close to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index ea1d959d037..502218096a9 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -360,10 +360,10 @@ typedef struct files_struct { struct { bool kernel_share_modes_taken : 1; bool update_write_time_triggered : 1; + bool update_write_time_on_close : 1; } fsp_flags; struct tevent_timer *update_write_time_event; - bool update_write_time_on_close; struct timespec close_write_time; bool write_time_forced; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 86412dc2bca..2f092b56ed0 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -321,7 +321,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, fsp_str_dbg(fsp))); ts = nt_time_to_full_timespec(lck->data->changed_write_time); set_close_write_time(fsp, ts); - } else if (fsp->update_write_time_on_close) { + } else if (fsp->fsp_flags.update_write_time_on_close) { /* Someone had a pending write. */ if (is_omit_timespec(&fsp->close_write_time)) { DEBUG(10,("close_remove_share_mode: update to current time " @@ -383,7 +383,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, /* * Don't try to update the write time when we delete the file */ - fsp->update_write_time_on_close = false; + fsp->fsp_flags.update_write_time_on_close = false; got_tokens = get_delete_on_close_token(lck, fsp->name_hash, &del_nt_token, &del_token); @@ -556,7 +556,7 @@ void set_close_write_time(struct files_struct *fsp, struct timespec ts) return; } fsp->write_time_forced = false; - fsp->update_write_time_on_close = true; + fsp->fsp_flags.update_write_time_on_close = true; fsp->close_write_time = ts; } @@ -568,7 +568,7 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp) init_smb_file_time(&ft); - if (!fsp->update_write_time_on_close) { + if (!(fsp->fsp_flags.update_write_time_on_close)) { return NT_STATUS_OK; } diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index 79cfbe29d29..3593f5e7ede 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -103,7 +103,8 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp, cookie.position_information = fsp->fh->position_information; cookie.update_write_time_triggered = fsp->fsp_flags.update_write_time_triggered; - cookie.update_write_time_on_close = fsp->update_write_time_on_close; + cookie.update_write_time_on_close = + fsp->fsp_flags.update_write_time_on_close; cookie.write_time_forced = fsp->write_time_forced; cookie.close_write_time = full_timespec_to_nt_time( &fsp->close_write_time); @@ -212,7 +213,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp, if (fsp->write_time_forced) { ft.mtime = nt_time_to_full_timespec( lck->data->changed_write_time); - } else if (fsp->update_write_time_on_close) { + } else if (fsp->fsp_flags.update_write_time_on_close) { if (is_omit_timespec(&fsp->close_write_time)) { ft.mtime = timespec_current(); } else { @@ -255,7 +256,8 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp, cookie.position_information = fsp->fh->position_information; cookie.update_write_time_triggered = fsp->fsp_flags.update_write_time_triggered; - cookie.update_write_time_on_close = fsp->update_write_time_on_close; + cookie.update_write_time_on_close = + fsp->fsp_flags.update_write_time_on_close; cookie.write_time_forced = fsp->write_time_forced; cookie.close_write_time = full_timespec_to_nt_time( &fsp->close_write_time); @@ -752,7 +754,8 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, fsp->fh->position_information = cookie.position_information; fsp->fsp_flags.update_write_time_triggered = cookie.update_write_time_triggered; - fsp->update_write_time_on_close = cookie.update_write_time_on_close; + fsp->fsp_flags.update_write_time_on_close = + cookie.update_write_time_on_close; fsp->write_time_forced = cookie.write_time_forced; fsp->close_write_time = nt_time_to_full_timespec( cookie.close_write_time); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index c8e31494b65..42431f0ba07 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -142,7 +142,7 @@ void trigger_write_time_update(struct files_struct *fsp) /* We need to remember someone did a write * and update to current time on close. */ - fsp->update_write_time_on_close = true; + fsp->fsp_flags.update_write_time_on_close = true; if (fsp->fsp_flags.update_write_time_triggered) { /* @@ -193,7 +193,7 @@ void trigger_write_time_update_immediate(struct files_struct *fsp) /* After an immediate update, reset the trigger. */ fsp->fsp_flags.update_write_time_triggered = true; - fsp->update_write_time_on_close = false; + fsp->fsp_flags.update_write_time_on_close = false; ft.mtime = timespec_current(); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ddeb4c6b04c..8a33533ced4 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -8351,7 +8351,7 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, * We're setting the time explicitly for UNIX. * Cancel any pending changes over all handles. */ - all_fsps->update_write_time_on_close = false; + all_fsps->fsp_flags.update_write_time_on_close = false; TALLOC_FREE(all_fsps->update_write_time_event); }