From 9b0aba40e836b7686c609fa6b5ab2e95ebb48e48 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 11 May 2020 18:18:24 +0200 Subject: [PATCH] s3:smbd: handle 0 length writes as no-op. They should never touch the SMB_VFS layer and they never trigger an DISK_FULL error. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14361 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison (cherry picked from commit ba68f21286c2c2f1fef8bf8c9cd500a622077887) --- source3/smbd/aio.c | 5 +++++ source3/smbd/fileio.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index cf35f3297ec..088ea603788 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -339,6 +339,11 @@ static struct tevent_req *pwrite_fsync_send(TALLOC_CTX *mem_ctx, state->fsp = fsp; state->write_through = write_through; + if (n == 0) { + tevent_req_done(req); + return tevent_req_post(req, ev); + } + subreq = SMB_VFS_PWRITE_SEND(state, ev, fsp, data, n, offset); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 31d5b7510b7..f4a3dde66b7 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -70,6 +70,10 @@ static ssize_t real_write_file(struct smb_request *req, { ssize_t ret; + if (n == 0) { + return 0; + } + fsp->fh->pos = pos; if (pos && lp_strict_allocate(SNUM(fsp->conn) && !fsp->is_sparse)) { -- 2.11.4.GIT