Final fix for the bug tridge found. Only push locks onto a blocking lock
authorJeremy Allison <jra@samba.org>
Fri, 1 Aug 2003 06:10:30 +0000 (06:10 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 1 Aug 2003 06:10:30 +0000 (06:10 +0000)
queue if the posix lock failed with EACCES or EAGAIN (this means another
lock conflicts). Else return an error and don't queue the request.
Jeremy.

source/libsmb/errormap.c
source/locking/locking.c

index 8ee5ee3d31e16d093a47e328abea6190f0924a7c..3d99e3d5e52ce765bbbe46c93162bade8705b37d 100644 (file)
@@ -1498,6 +1498,7 @@ const struct unix_error_map unix_dos_nt_errmap[] = {
        { ENFILE, ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES },
        { EMFILE, ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES },
        { ENOSPC, ERRHRD, ERRdiskfull, NT_STATUS_DISK_FULL },
+       { ENOMEM, ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY },
 #ifdef EDQUOT
        { EDQUOT, ERRHRD, ERRdiskfull, NT_STATUS_DISK_FULL },
 #endif
index f4de83c3464ea3a24496995272dce21af4033ea4..4475f1446f90f6196e53ba25ce601dafe14438b5 100644 (file)
@@ -125,7 +125,11 @@ static NTSTATUS do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_p
                         */
 
                        if (!set_posix_lock(fsp, offset, count, lock_type)) {
-                               status = NT_STATUS_LOCK_NOT_GRANTED;
+                               if (errno == EACCES || errno == EAGAIN)
+                                       status = NT_STATUS_FILE_LOCK_CONFLICT;
+                               else
+                                       status = map_nt_error_from_unix(errno);
+
                                /*
                                 * We failed to map - we must now remove the brl
                                 * lock entry.