The invention provides a method and
system for correct
interoperation of multiple diverse
file server or
file locking protocols, using a uniform multi-protocol lock
management system. A
file server determines, before allowing any
client device to access data or to obtain a lock, whether that would be inconsistent with existing locks, regardless of originating
client device or originating protocol for those existing locks. A first protocol enforces mandatory file-open and file-locking together with an opportunistic file-locking technique, while a second protocol lacks file-open
semantics and provides only for advisory
byte-range and
file locking. Enforcing file-locking protects file data against corruption by NFS
client devices. A CIFS client device, upon opening a file, can obtain an "oplock" (an opportunistic lock). When a client device issues a non-CIFS protocol request for the oplocked file, the
file server sends an oplock-break message to the CIFS client device, giving the CIFS client device the opportunity to flush any cached write operations and possibly close the file. Allowing NFS and NLM requests to break oplocks ensures that file data remains available to NFS client devices simultaneously with protecting integrity of that file data. A CIFS client device can obtain a "change-monitoring" lock for a
directory in the
file system, so as to be notified by the file
server whenever there is a change to that
directory. The file
server notes changes to the
directory by both CIFS and non-CIFS client devices, and notifies those CIFS client devices with "change-monitoring" locks of those changes.