Syllable Forum Index Syllable
Syllable Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Samba 3.0.28 aborts(): fcntl F_SETLK

 
Post new topic   Reply to topic    Syllable Forum Index -> Bugs - Fixed
View previous topic :: View next topic  
Author Message
Vanders
The Knights of Syllable


Joined: 14 Sep 2007
Posts: 849

PostPosted: Mon Jan 21, 2008 5:10 pm    Post subject: Samba 3.0.28 aborts(): fcntl F_SETLK Reply with quote

Samba 3.0.28 smbd will abort() early from within the function tdb_brlock() when it attempts to set a RW lock on a descriptor which already has a RO lock set.

The problem seems to be that fcntl() with F_SETLK[W] returns -EDEADLK. This traces all the way to flock.c: detect_deadlock(), which checks for locks from the same thread. At no point does lock_inode_record() appear to consider the case where a lock is being converted from one type to another.

The relevant section of the specification at http://www.opengroup.org/onlinepubs/009695399/functions/fcntl.html

[quote]There shall be at most one type of lock set for each byte in the file. Before a successful return from an F_SETLK or an F_SETLKW request when the calling process has previously existing locks on bytes in the region specified by the request, the previous lock type for each byte in the specified region shall be replaced by the new lock type. As specified above under the descriptions of shared locks and exclusive locks, an F_SETLK or an F_SETLKW request (respectively) shall fail or block when another process has existing locks on bytes in the specified region and the type of any of those locks conflicts with the type specified in the request.
[/quote]

fcntl() F_SETLK[W] must consider cases where a process is replacing an existing lock with a new lock.
Back to top
View user's profile Send private message Send e-mail
Vanders
The Knights of Syllable


Joined: 14 Sep 2007
Posts: 849

PostPosted: Tue Jan 22, 2008 8:27 am    Post subject: Reply with quote

I think I have a proper fix for fcntl() F_SETLK in CVS now. Samba 3.0.28 works, but I don't have any proper conformance tests to check the functionality is correct. What's there now [i]should[/i] be sufficient.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Syllable Forum Index -> Bugs - Fixed All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group