Bug 253737 - CIFS: bad test for unlocking when posix extensions are disabled
CIFS: bad test for unlocking when posix extensions are disabled
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jeff Layton
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-08-21 12:58 EDT by Jeff Layton
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-08-28 08:19:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed patch (537 bytes, patch)
2007-08-21 13:17 EDT, Jeff Layton
no flags Details | Diff

  None (edit)
Description Jeff Layton 2007-08-21 12:58:28 EDT
Noticed by inspection...

On a fcntl unlock request CIFS walks the list of SMB locks on a file and unlocks
any that fall completely within the unlock range. The test used is bogus though:

     if (pfLock->fl_start <= li->offset && length >= li->length) {

...this should be:

     if (pfLock->fl_start <= li->offset &&
           (pflock->fl_start + length) >=
           (li->offset + li->length)) {
Comment 1 Jeff Layton 2007-08-21 13:07:28 EDT
Trivial reproducer:

open file
lock: start=0 len=1
lock: start=2 len=1
unlock: start=0 len=1

...on the unlock, the client sends an unlock request to the server for both
locks even though the unlock range doesn't come near the second lock.
Comment 2 Jeff Layton 2007-08-21 13:17:58 EDT
Created attachment 161991 [details]
proposed patch

Proposed patch that I sent to linux-cifs-client list.
Comment 3 Jeff Layton 2007-08-28 08:19:52 EDT
Patch is now applied upstream and should make it into 2.6.24.

Note You need to log in before you can comment on or make changes to this bug.