smbd: Fix breaking level2 on allocate
authorVolker Lendecke <vl@samba.org>
Thu, 5 Sep 2013 10:33:21 +0000 (10:33 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 5 Sep 2013 20:42:05 +0000 (13:42 -0700)
This needs doing even if we don't have strct allocate set. The client
should not know that we lied. Fixes smb2.oplock.batch12.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail
source3/smbd/vfs.c

index 6fe7ce5c01fac396d30df8d70c9817fdef97b70f..8b89f00f60b22e6fb7641ac3ecaaf70635f4fe08 100644 (file)
 ^samba3.smb2.lease.oplock
 ^samba3.smb2.lease.multibreak
 ^samba3.smb2.lease.v2_request
-^samba3.smb2.oplock.batch12
 ^samba3.smb2.oplock.batch20
 ^samba3.smb2.oplock.stream1
 ^samba3.smb2.streams.rename
index 49609d0179412196b7f447749acb10dd690bd9f9..ca6500cf8cc69564cb16edb7cc62f00eaed9a826 100644 (file)
@@ -561,16 +561,17 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
                return ret;
        }
 
-       if (!lp_strict_allocate(SNUM(fsp->conn)))
-               return 0;
-
        /* Grow - we need to test if we have enough space. */
 
        contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_GROW);
 
-       /* See if we have a syscall that will allocate beyond end-of-file
-          without changing EOF. */
-       ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_KEEP_SIZE, 0, len);
+       if (lp_strict_allocate(SNUM(fsp->conn))) {
+               /* See if we have a syscall that will allocate beyond
+                  end-of-file without changing EOF. */
+               ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_KEEP_SIZE, 0, len);
+       } else {
+               ret = 0;
+       }
 
        contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_ALLOC_GROW);