1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

407 Commits

Author SHA1 Message Date
Volker Lendecke
b067a5e4e8 s3: Remove debug_ctx()
smbd just crashed on me: In a debug message I called a routine preparing a
string that itself used debug_ctx. The outer routine also used it after the
inner routine had returned. It was still referencing the talloc context
that the outer debug_ctx() had given us, which the inner DEBUG had already
freed.
2009-11-03 11:30:00 +01:00
Jeremy Allison
3fa1d7332c Fix bug 6776 - Running overlapping Byte Lock test will core dump Samba daemon.
Re-write core of POSIX locking logic.
Jeremy.
2009-10-05 10:27:48 -07:00
Volker Lendecke
99f8dcab0c s3:smbd: Add the ntstatus to the smb_panic in share_mode_lock_destructor
This might help finding why bug 6518 happens
2009-09-07 01:28:32 +02:00
Volker Lendecke
033185e2a1 Make the smbd VFS typesafe 2009-07-24 11:42:05 -04:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Tim Prouty
3a7d372e2e s3: Change the share_mode_lock struct to store a base_name and stream_name 2009-07-08 21:36:04 -07:00
Tim Prouty
83e5ac5695 s3: Make some arguments to (parse|unparse)_share_modes() const 2009-07-08 21:36:04 -07:00
Tim Prouty
0d9b204882 s3: Remove unnecessary const qualifiers 2009-07-07 18:02:53 -07:00
Tim Prouty
18a27a8df2 s3 sticky write time: Removed unused args and tighten up a function by making an arg const 2009-07-06 15:38:41 -07:00
Volker Lendecke
ed88ff18dd Fix Coverity ID 897: REVERSE_INULL 2009-05-06 12:01:30 +02:00
Volker Lendecke
b63cd72ae4 Use procid_str in debug messages for better cluster-debuggability 2009-04-03 12:19:20 +02:00
Volker Lendecke
c164c0c20a Fix a scary "fill_share_mode_lock failed" message
To me "fill_share_mode_lock failed" is a "can't happen" alert. There is
however a perfectly valid case in get_file_infos() when the file is not open.

Change the corresponding debug message to level 10 and explain more.
2009-03-26 12:30:44 +01:00
Dave Richards
1fcc11ff25 s3: Add strict lock/unlock calls to the vfs layer to replace is_locked 2009-03-13 14:16:55 -07:00
Jeremy Allison
0d9f4a2886 Last part of fix for #6154 - zfs does not honor admin users.
Jeremy.
2009-03-05 15:18:18 -08:00
Zack Kirsch
a04bb5f9a2 s3 BRL: Add more clarifying comments and add implied logic to make conditional more clear 2009-02-20 16:42:50 -08:00
Tim Prouty
e4675ce8db s3: Add extid to the dev/inode pair
This extends the file_id struct to add an additional generic uint64_t
field: extid.  For backwards compatibility with dev/inodes stored in
xattr_tdbs and acl_tdbs, the ext id is ignored for these databases.
This patch should cause no functional change on systems that don't use
SMB_VFS_FILE_ID_CREATE to set the extid.

Existing code that uses the smb_share_mode library will need to be
updated to be compatibile with the new extid.
2009-02-19 20:58:26 -08:00
Zack Kirsch
ca87726f81 s3: Fix uninitialized variable warning (and bug). 2009-02-13 15:59:39 -08:00
Zack Kirsch
813273c87e Add VFS ops for Windows BRL: Lock, Unlock and Cancel:
This patch adds 3 new VFS OPs for Windows byte range locking: BRL_LOCK_WINDOWS,
BRL_UNLOCK_WINDOWS and BRL_CANCEL_WINDOWS. Specifically:

* I renamed brl_lock_windows, brl_unlock_windows and brl_lock_cancel to
  *_default as the default implementations of the VFS ops.
* The blocking_lock_record (BLR) is now passed into the brl_lock_windows and
  brl_cancel_windows paths. The Onefs implementation uses it - future
  implementations may find it useful too.
* Created brl_lock_cancel to do what brl_lock/brl_unlock do: set up a
  lock_struct and call either the Posix or Windows lock function. These happen
  to be the same for the default implementation.
* Added helper functions: increment_current_lock_count() and
  decrement_current_lock_count().
* Minor spelling correction in brl_timeout_fn: brl -> blr.
* Changed blocking_lock_cancel() to return the BLR that it has cancelled. This
  allows us to assert its the lock that we wanted to cancel. If this assert ever
  fires, this path will need to take in the BLR to cancel, rather than choosing
  on its own.
* Adds a small helper function: find_blocking_lock_record_by_id(). Used by the
  OneFS implementation, but could be useful for others.
2009-02-13 10:08:40 -08:00
Volker Lendecke
77e3272092 Fix an uninitialized variable. Tim, please check! 2009-02-10 18:29:34 +01:00
Tim Prouty
c6f1f055fd s3 oplocks: Make the level2 oplock contention API more granular
This replaces release_level2_oplocks_on_change with
contend_level2_oplock_begin/end in order to contend level2 oplocks
throughout an operation rather than just at the begining.  This is
necessary for some kernel oplock implementations, and also lays the
groundwork for better correctness in Samba's standard level2 oplock
handling.  The next step for non-kernel oplocks is to add additional
state to the share mode lock struct that prevents any new opens from
granting oplocks while a contending operation is in progress.

All operations that contend level 2 oplocks are now correctly spanned
except for aio and synchronous writes.  The two write paths both have
non-trivial error paths that need extra care to get right.

RAW-OPLOCK and the rest of 'make test' are still passing with this
change.
2009-02-09 23:47:45 -08:00
Jeremy Allison
d0eeb9aa8d Fix more asprintf warnings and some error path errors.
Jeremy.
2008-12-23 12:11:12 -08:00
Jeremy Allison
1a5fc6d4bc Fix bug #5979 - Level 2 oplocks being granted improperly,
Jeremy.
2008-12-17 17:23:13 -08:00
Tim Prouty
7b9f6dda13 s3: [3/3]: Fix a delete on close divergence from windows and the associated torture test
This third patch cleans up by removing all of the code that is made
obsolete by the first patch.  It should cause no functional changes.
2008-12-09 18:06:49 -08:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Jeremy Allison
e76cb70444 Fix debug message to show correct function name.
Jeremy.
(This used to be commit 079c75ef3c)
2008-09-05 20:37:00 -07:00
Jeremy Allison
405b072431 Write times code update.
Ok, here's the fix for the write times breakage
with the new tests in S4 smbtorture.

The key is keeping in the share mode struct
the "old_file_time" as the real write time,
set by all the write and allocation calls,
and the "changed_write_time" as the "sticky"
write time - set by the SET_FILE_TIME calls.

We can set them independently (although I
kept the optimization of not setting the
"old_file_time" is a "changed_write_time"
was already set, as we'll never see it.

This allows us to update the write time
immediately on the SMBwrite truncate case,
SET_END_OF_FILE and SET_ALLOCATION_SIZE calls,
whilst still have the 2 second delay on the
"normal" SMBwrite, SMBwriteX calls.

I think in a subsequent patch I'd like to
change the name of these from "old_file_time"
to "write_time" and "changed_write_time" to
"sticky_write_time" to make this clearer.

I think I also fixed a bug in Metze's original
code in that once a write timestamp had been
set from a "normal" SMBwriteX call the fsp->update_write_time_triggered
variable was set and then never reset - thus
meaning the write timestamp would never get
updated again on subsequent SMBwriteX's.

The new code checks the update_write_time_event
event instead, and doesn't update is there's
an event already scheduled.

Metze especially, please check this over for
your understanding.

Jeremy.
(This used to be commit 6f20585419)
2008-09-05 19:00:48 -07:00
Volker Lendecke
ae923dbd4e Fix alignment problems on sparc, bug 5512
Patch successfully tested by Christoph Kaegi <kaph@zhaw.ch>, thanks.
(cherry picked from commit 9f8df16f47)
(This used to be commit 82ed19ff64)
2008-07-09 20:47:31 +02:00
Jeremy Allison
6811dc3fc2 Allow server manager to close open files selected by id.
Jeremy.
(This used to be commit 7eeed8bb41)
2008-05-27 11:25:46 -07:00
Jeremy Allison
b430b38220 Remove the "stat_open()" function, flag, and all associated code. It was only
being (correctly) used in the can_read/can_write checks for hide unreadable/unwritable
and this is more properly done using the functions in smbd/file_access.c.
Preparing to do NT access checks on all file access.
Jeremy.
(This used to be commit 6bfb06ad95)
2008-05-02 17:22:10 -07:00
Michael Adam
8c9060240e Slight reformatting of fd_close_posix(), while I'm at it.
Wrap lines and remove trailing space.

Michael
(This used to be commit 74ed53a115)
2008-04-21 00:21:24 +02:00
Michael Adam
2f8dde9ec8 Change fd_close_posix() to return int instead of NTSTATUS.
The errno is handed up through the VFS layer to the callers.

Michael
(This used to be commit d928e6648d)
2008-04-21 00:21:24 +02:00
Michael Adam
96e9e83ee0 Don't modify the fsp in fd_close_posix() anymore.
Now that it is inside the vfs layer, this function should
not alter the fsp (i.e. set fsp->fh->fd = -1) anymore.
That belongs above the vfs layer.

Michael
(This used to be commit df264bf3e0)
2008-04-21 00:21:24 +02:00
Michael Adam
3756467db6 Move the posix pending close functionality down into the VFS layer.
This hides the pending close fds from the outside. Call order
of SMB_VFS_CLOSE is reversed. Originally, it was:

fd_close -> fd_close_posix -> SMB_VFS_CLOSE -> close

And now it is:

fd_close -> SMB_VFS_CLOSE -> fd_close_posix -> close

This is in preparation of removing the fd parameter
from the SMB_VFS_CLOSE function. But it is also the right
place for the pending close calls anyways.

Michael
(This used to be commit 3cf56b124a)
2008-04-21 00:21:23 +02:00
Jeremy Allison
e76ec752be Quieten valgrind message on make valgrindtest. This doesn't
seem to be valid (vl - feel free to confirm).
Jeremy.
(This used to be commit 43b0254d93)
2008-04-11 17:23:48 -07:00
Stefan Metzmacher
851cadba51 locking: combine get_delete_on_close_flag() and get_write_time() into get_file_infos()
This means we need to fetch the record only once.

metze
(This used to be commit 4130b87329)
2008-04-07 12:29:29 +02:00
Stefan Metzmacher
2ccf50256e locking: store the write time in the locking.tdb
This is needed to implement the strange write time update
logic later. We need to store 2 time timestamps to
distinguish between the time the file system had before
the first client opened the file and a forced timestamp update.

metze
(This used to be commit 6aaa2ce0ee)
2008-04-07 12:29:25 +02:00
Volker Lendecke
1709954933 Merge leftovers of 0e1a86bc845 in 3-0-ctdb
(This used to be commit 64b1625f8e)
2008-03-17 14:56:45 +01:00
Volker Lendecke
33f3eeaa00 Fix some "set but never used" warnings
(This used to be commit 4a6dadc517)
2008-01-20 17:44:40 +01:00
Alexander Bokovoy
68694369fc Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0-ctdb)
Signed-off-by: Alexander Bokovoy <ab@samba.org>(This used to be commit 0c8e23afbb)
2008-01-16 12:09:48 +03:00
Volker Lendecke
8d464d470a Don't early delete the share mode tdb data
We now refer directly to the file name in the tdb data, so don't delete it.
(This used to be commit 71de4946cf)
2008-01-12 23:57:12 +01:00
Volker Lendecke
5a8bbc64cc Trivial simplification
(This used to be commit 616bc34744)
2008-01-12 23:57:11 +01:00
Volker Lendecke
5ddb2abf76 Some more talloc_tos()
(This used to be commit 444e35e7df)
2008-01-10 13:19:58 +01:00
Volker Lendecke
3cc3b9e187 use talloc_tos in a few more places
(This used to be commit 65dd869bea)
2008-01-10 13:19:58 +01:00
Michael Adam
f7bf4cb3f1 Remove redundant parameter fd from SMB_VFS_GETLOCK().
Michael
(This used to be commit ee5a20becd)
2008-01-07 22:18:50 +01:00
Volker Lendecke
fa6d7b42f1 Do not talloc_strdup filename and servicepath
(This used to be commit 66be770993)
2008-01-07 21:18:20 +01:00
Michael Adam
edd30e716f Remove redundant parameter fd from SMB_VFS_LOCK().
Michael
(This used to be commit 4f3ab2c406)
2008-01-07 16:38:23 +01:00
Volker Lendecke
a8d2664fec allocate share_mode_str only when needed
(This used to be commit a98693bfa7)
2008-01-04 23:32:24 +01:00
Michael Adam
4773973300 Remove redundant connection_struct from fd_close_posix() parameter list.
Michael
(This used to be commit f3365b74ac)
2007-12-22 02:01:32 +01:00
Volker Lendecke
a347ff84bc Convert the posix_pending_close_db to dbwrap_rbt
(This used to be commit 841f4ccbfb)
2007-12-11 16:16:54 +01:00
Volker Lendecke
d60fac2a5a Tiny simplifications
locking.c:open_read_only was unused

don't export the silly boolean flag locking_init(bool read_only)
(This used to be commit 2f3c865707)
2007-12-10 12:22:01 +01:00