summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-01-09 14:30:53 +0100
committerJeremy Allison <jra@samba.org>2012-01-12 23:59:22 +0100
commit9cf6d735d43f6f905b19f52d38c93aa30092333d (patch)
treefd75eba7dc698d61b3f8d5ef240c31fef068f28a /source3/smbd
parent540e51f77e07cc65b6b097f8ff01cd10f04644d0 (diff)
downloadsamba-9cf6d735d43f6f905b19f52d38c93aa30092333d.tar.gz
samba-9cf6d735d43f6f905b19f52d38c93aa30092333d.tar.bz2
samba-9cf6d735d43f6f905b19f52d38c93aa30092333d.zip
s3: Introduce get_share_mode_lock_fresh()
This slightly simplifies the code path for all callers which assume that a share mode exists already. Only the callers in open_file_ntcreate and open_directory will ever create new share modes. Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c10
-rw-r--r--source3/smbd/open.c15
-rw-r--r--source3/smbd/oplock.c9
-rw-r--r--source3/smbd/reply.c3
-rw-r--r--source3/smbd/trans2.c3
5 files changed, 14 insertions, 26 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 26656f47a2..a07ab4b42c 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -347,9 +347,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
* This prevents race conditions with the file being created. JRA.
*/
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
-
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0, ("close_remove_share_mode: Could not get share mode "
"lock for file %s\n", fsp_str_dbg(fsp)));
@@ -617,7 +615,7 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
* must update it in the open file db too. */
(void)set_write_time(fsp->file_id, fsp->close_write_time);
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL, NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck) {
/* Close write times overwrite sticky write times
so we must replace any sticky write time here. */
@@ -1019,9 +1017,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
* reference to a directory also.
*/
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
-
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0, ("close_directory: Could not get share mode lock for "
"%s\n", fsp_str_dbg(fsp)));
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index dbc4dba448..46d5d28863 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1584,8 +1584,7 @@ NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
void remove_deferred_open_entry(struct file_id id, uint64_t mid,
struct server_id pid)
{
- struct share_mode_lock *lck = get_share_mode_lock(talloc_tos(), id,
- NULL, NULL, NULL);
+ struct share_mode_lock *lck = get_share_mode_lock(talloc_tos(), id);
if (lck == NULL) {
DEBUG(0, ("could not get share mode lock\n"));
return;
@@ -1629,11 +1628,8 @@ static bool acquire_ordered_locks(TALLOC_CTX *mem_ctx,
lock on the brlock database. */
}
- *p_lck = get_share_mode_lock(mem_ctx,
- id,
- connectpath,
- smb_fname,
- p_old_write_time);
+ *p_lck = get_share_mode_lock_fresh(
+ mem_ctx, id, connectpath, smb_fname, p_old_write_time);
if (*p_lck == NULL) {
DEBUG(0, ("Could not get share mode lock\n"));
@@ -2928,8 +2924,9 @@ static NTSTATUS open_directory(connection_struct *conn,
return NT_STATUS_ACCESS_DENIED;
}
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id,
- conn->connectpath, smb_dname, &mtimespec);
+ lck = get_share_mode_lock_fresh(talloc_tos(), fsp->file_id,
+ conn->connectpath, smb_dname,
+ &mtimespec);
if (lck == NULL) {
DEBUG(0, ("open_directory: Could not get share mode lock for "
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 7a810d9a20..e1731f1e10 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -162,8 +162,7 @@ bool remove_oplock(files_struct *fsp)
struct share_mode_lock *lck;
/* Remove the oplock flag from the sharemode. */
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0,("remove_oplock: failed to lock share entry for "
"file %s\n", fsp_str_dbg(fsp)));
@@ -189,8 +188,7 @@ bool downgrade_oplock(files_struct *fsp)
bool ret;
struct share_mode_lock *lck;
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0,("downgrade_oplock: failed to lock share entry for "
"file %s\n", fsp_str_dbg(fsp)));
@@ -760,8 +758,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
if (!LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
return;
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0,("release_level_2_oplocks_on_change: failed to lock "
"share mode entry for file %s.\n", fsp_str_dbg(fsp)));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 4954098de7..b8da33549c 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6207,8 +6207,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
status = NT_STATUS_ACCESS_DENIED;
}
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
/*
* We have the file open ourselves, so not being able to get the
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index ec9901b99e..4e86fbfcdd 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7572,8 +7572,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
* non-POSIX opens return SHARING_VIOLATION.
*/
- lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
- NULL);
+ lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck == NULL) {
DEBUG(0, ("smb_posix_unlink: Could not get share mode "
"lock for file %s\n", fsp_str_dbg(fsp)));