From ba15d622d3e9d1eaf0b740c1367dee50f4b29e5c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Oct 2004 06:17:52 +0000 Subject: r3241: don't skip the read completely for a zero-length read, as it could give a lock conflict (This used to be commit 7ce6139f984c72a6347c7a64d95d5278bcf3e868) --- source4/ntvfs/posix/pvfs_read.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c index ee750a138f..b36840cb15 100644 --- a/source4/ntvfs/posix/pvfs_read.c +++ b/source4/ntvfs/posix/pvfs_read.c @@ -33,6 +33,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs, ssize_t ret; struct pvfs_file *f; NTSTATUS status; + uint32_t maxcnt; if (rd->generic.level != RAW_READ_READX) { return ntvfs_map_read(req, rd, ntvfs); @@ -51,15 +52,14 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs, return NT_STATUS_ACCESS_VIOLATION; } - /* this matches w2k3 behaviour for attempted large reads */ - if (rd->readx.in.maxcnt > UINT16_MAX) { - ret = 0; - goto done_read; + maxcnt = rd->readx.in.maxcnt; + if (maxcnt > UINT16_MAX) { + maxcnt = 0; } - + status = pvfs_check_lock(pvfs, f, req->smbpid, rd->readx.in.offset, - rd->readx.in.maxcnt, + maxcnt, READ_LOCK); if (!NT_STATUS_IS_OK(status)) { return status; @@ -67,13 +67,12 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs, ret = pread(f->fd, rd->readx.out.data, - rd->readx.in.maxcnt, + maxcnt, rd->readx.in.offset); if (ret == -1) { return pvfs_map_errno(pvfs, errno); } -done_read: f->position = f->seek_offset = rd->readx.in.offset + ret; rd->readx.out.nread = ret; -- cgit