[PATCH] dbwrap_ctdb: Treat empty records as non-existing

Christian Ambach ambi at samba.org
Tue Sep 3 23:03:28 CEST 2013


Am 03.09.13 20:22, schrieb Volker Lendecke:
> On Fri, Aug 30, 2013 at 09:24:03PM +0200, Christian Ambach wrote:
>> I still feel that we should add the attached patch.
>> The absence of level 0 logs does not mean that everything is correct now :)
>> Imagine the following flow:
>> 1. File gets opened first time => TDB entry gets created
>> 2. File gets closed => destructor will delete the record,
>> db_ctdb_delete() will simply store it as empty and send deletion request
>> to CTDB
>> 3. Before vacuuming kicks in, file gets re-opened
>> 4. fetch_share_mode_locked (and also fetch_share_mode_unlocked) will
>> call parse_share_modes on empty record, leading the code into
>> parse_share_modes while it should have gone into fresh_share_mode_lock.
>>
>> I verified that this happens, however I am not sure about the results
>> and side-effects. The fresh marker will definitely be set to the wrong
>
> Can you show me the callstack where it happens? We should
> prevent it within dbwrap_ctdb.c.

Attached is the callstack when opening/closing/re-opening a file within
a brief period of time (so vacuuming did not delete the record in the
local TDB).

However, this does not give a clue which path was taken through dbwrap.
I think the main point is that this record needs to be local, so access
goes through the ltdb shortcut. A fetch from a remote node would not
have delivered the record.

Cheers,
Christian


-------------- next part --------------
#0  parse_share_modes (mem_ctx=mem_ctx at entry=0x7febf818d3a0, dbuf=...) at ../source3/locking/share_mode_lock.c:121
#1  0x00007febf64fbd25 in get_share_mode_lock_internal (old_write_time=0x7fff97bc07d0, smb_fname=0x7febf819cf10, 
    servicepath=0x7febf818e660 "/home/ambi/shares/abc", id=..., mem_ctx=0x7febf818d3a0) at ../source3/locking/share_mode_lock.c:314
#2  get_share_mode_lock (mem_ctx=0x7febf818c560, id=..., servicepath=servicepath at entry=0x7febf818e660 "/home/ambi/shares/abc", 
    smb_fname=smb_fname at entry=0x7febf819cf10, old_write_time=old_write_time at entry=0x7fff97bc07d0) at ../source3/locking/share_mode_lock.c:366
#3  0x00007febf646bcc8 in open_file_ntcreate (conn=conn at entry=0x7febf818e9e0, req=req at entry=0x7febf818c680, access_mask=access_mask at entry=1179785, 
    share_access=3, create_disposition=1, create_options=create_options at entry=64, new_dos_attributes=new_dos_attributes at entry=0, 
    oplock_request=oplock_request at entry=0, private_flags=private_flags at entry=0, pinfo=pinfo at entry=0x7fff97bc0a50, fsp=fsp at entry=0x7febf819d660)
    at ../source3/smbd/open.c:2397
#4  0x00007febf646eec0 in create_file_unixpath (conn=conn at entry=0x7febf818e9e0, req=req at entry=0x7febf818c680, 
    smb_fname=smb_fname at entry=0x7febf818c8c0, access_mask=access_mask at entry=1179785, share_access=share_access at entry=3, 
    create_disposition=create_disposition at entry=1, create_options=create_options at entry=64, file_attributes=file_attributes at entry=0, 
    oplock_request=oplock_request at entry=0, allocation_size=allocation_size at entry=0, private_flags=private_flags at entry=0, sd=sd at entry=0x0, 
    ea_list=ea_list at entry=0x0, result=result at entry=0x7fff97bc0b80, pinfo=pinfo at entry=0x7fff97bc0b70) at ../source3/smbd/open.c:3833
#5  0x00007febf646fe62 in create_file_default (conn=0x7febf818e9e0, req=0x7febf818c680, root_dir_fid=<optimized out>, smb_fname=0x7febf818c8c0, 
    access_mask=1179785, share_access=3, create_disposition=create_disposition at entry=1, create_options=create_options at entry=64, 
    file_attributes=file_attributes at entry=0, oplock_request=oplock_request at entry=0, allocation_size=allocation_size at entry=0, 
    private_flags=private_flags at entry=0, sd=sd at entry=0x0, ea_list=ea_list at entry=0x0, result=result at entry=0x7fff97bc0de0, 
    pinfo=pinfo at entry=0x7fff97bc0d50) at ../source3/smbd/open.c:4229
#6  0x00007febf654a4db in vfswrap_create_file (handle=<optimized out>, req=<optimized out>, root_dir_fid=<optimized out>, smb_fname=<optimized out>, 
    access_mask=<optimized out>, share_access=<optimized out>, create_disposition=1, create_options=64, file_attributes=0, oplock_request=0, 
    allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x7fff97bc0de0, pinfo=0x7fff97bc0d50) at ../source3/modules/vfs_default.c:527
#7  0x00007febf6476775 in smb_vfs_call_create_file (handle=<optimized out>, req=req at entry=0x7febf818c680, root_dir_fid=root_dir_fid at entry=0, 
    smb_fname=<optimized out>, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=1, create_options=64, 
    file_attributes=file_attributes at entry=0, oplock_request=oplock_request at entry=0, allocation_size=allocation_size at entry=0, private_flags=0, 
    sd=sd at entry=0x0, ea_list=ea_list at entry=0x0, result=result at entry=0x7fff97bc0de0, pinfo=pinfo at entry=0x7fff97bc0d50) at ../source3/smbd/vfs.c:1544
#8  0x00007febf6439f60 in reply_open_and_X (req=req at entry=0x7febf818c680) at ../source3/smbd/reply.c:2114
#9  0x00007febf648ca31 in switch_message (type=<optimized out>, req=req at entry=0x7febf818c680) at ../source3/smbd/process.c:1558
#10 0x00007febf648db65 in construct_reply (deferred_pcd=0x0, encrypted=false, seqnum=0, unread_bytes=0, size=92, inbuf=0x0, sconn=0x7febf817bd20)
    at ../source3/smbd/process.c:1594



More information about the samba-technical mailing list