summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs/posix/pvfs_write.c')
-rw-r--r--source4/ntvfs/posix/pvfs_write.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c
index a49f4fe947..80a3dae3a7 100644
--- a/source4/ntvfs/posix/pvfs_write.c
+++ b/source4/ntvfs/posix/pvfs_write.c
@@ -33,6 +33,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
struct pvfs_state *pvfs = ntvfs->private_data;
ssize_t ret;
struct pvfs_file *f;
+ NTSTATUS status;
switch (wr->generic.level) {
case RAW_WRITE_WRITEX:
@@ -40,6 +41,14 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
+ status = pvfs_check_lock(pvfs, f, req->smbpid,
+ wr->writex.in.offset,
+ wr->writex.in.count,
+ WRITE_LOCK);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
ret = pwrite(f->fd,
wr->writex.in.data,
wr->writex.in.count,
@@ -62,6 +71,14 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
/* a truncate! */
ret = ftruncate(f->fd, wr->write.in.offset);
} else {
+ status = pvfs_check_lock(pvfs, f, req->smbpid,
+ wr->write.in.offset,
+ wr->write.in.count,
+ WRITE_LOCK);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
ret = pwrite(f->fd,
wr->write.in.data,
wr->write.in.count,