From 1ccd335af5d6c6c16d9ab46102b506798bb283fa Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 3 Apr 2020 07:39:34 +0200 Subject: [PATCH] smbd: move files_struct.aio_write_behind to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/include/vfs.h | 2 +- source3/smbd/aio.c | 5 +++-- source3/smbd/durable.c | 2 +- source3/smbd/files.c | 2 +- source3/smbd/open.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index a09e189cede..92f240c61b4 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -367,6 +367,7 @@ typedef struct files_struct { bool can_write : 1; bool modified : 1; bool is_directory : 1; + bool aio_write_behind : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -387,7 +388,6 @@ typedef struct files_struct { struct lock_struct last_lock_failure; int current_lock_count; /* Count the number of outstanding locks and pending locks. */ - bool aio_write_behind; bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */ bool delete_on_close; uint64_t posix_flags; diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index f0073837020..7ed2691cfbf 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -490,7 +490,8 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn, contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WRITE); if (!aio_ex->write_through && !lp_sync_always(SNUM(fsp->conn)) - && fsp->aio_write_behind) { + && fsp->fsp_flags.aio_write_behind) + { /* Lie to the client and immediately claim we finished the * write. */ SSVAL(aio_ex->outbuf.data,smb_vwv2,numtowrite); @@ -542,7 +543,7 @@ static void aio_pwrite_smb1_done(struct tevent_req *req) mark_file_modified(fsp); - if (fsp->aio_write_behind) { + if (fsp->fsp_flags.aio_write_behind) { if (nwritten != numtowrite) { if (nwritten == -1) { diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index 26537567e8e..f01df16ec92 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -703,7 +703,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, /* * We do not support aio write behind for smb2 */ - fsp->aio_write_behind = false; + fsp->fsp_flags.aio_write_behind = false; fsp->oplock_type = e.op_type; if (fsp->oplock_type == LEASE_OPLOCK) { diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 7e2d12b8794..6269dd94dd5 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -795,7 +795,7 @@ NTSTATUS dup_file_fsp( ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0); to->fsp_flags.modified = from->fsp_flags.modified; to->fsp_flags.is_directory = from->fsp_flags.is_directory; - to->aio_write_behind = from->aio_write_behind; + to->fsp_flags.aio_write_behind = from->fsp_flags.aio_write_behind; return fsp_set_smb_fname(to, from->fsp_name); } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 63018759dfb..5fe5c1e58dc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1441,7 +1441,7 @@ static NTSTATUS open_file(files_struct *fsp, if (conn->aio_write_behind_list && is_in_path(smb_fname->base_name, conn->aio_write_behind_list, conn->case_sensitive)) { - fsp->aio_write_behind = True; + fsp->fsp_flags.aio_write_behind = true; } DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n", -- 2.47.3