summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-08 09:20:08 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-12 17:35:04 +0100
commit7ba236d78e02fb8413db8c6ac74b9e89e64e847b (patch)
tree1bf9297a4f733396fbf2fe0cc92b5aea5c878080 /source4/ntvfs/posix/pvfs_open.c
parent59917521e9d811efe7b424d49f03fb972ee0a119 (diff)
downloadsamba-7ba236d78e02fb8413db8c6ac74b9e89e64e847b.tar.gz
samba-7ba236d78e02fb8413db8c6ac74b9e89e64e847b.tar.bz2
samba-7ba236d78e02fb8413db8c6ac74b9e89e64e847b.zip
pvfs_open: pass down &f->handle->fd to odb_open_file()
metze (This used to be commit 80f5f9362100b971fa12ffee33705b745131770e)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 2e757e1742..ceda3a6da0 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -300,7 +300,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
/* now really mark the file as open */
status = odb_open_file(lck, f->handle, name->full_name,
- false, OPLOCK_NONE, NULL);
+ NULL, false, OPLOCK_NONE, NULL);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(lck);
@@ -360,7 +360,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
}
status = odb_open_file(lck, f->handle, name->full_name,
- false, OPLOCK_NONE, NULL);
+ NULL, false, OPLOCK_NONE, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto cleanup_delete;
@@ -688,19 +688,6 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
return status;
}
- status = odb_open_file(lck, f->handle, name->full_name,
- allow_level_II_oplock,
- oplock_level, &oplock_granted);
- talloc_free(lck);
- if (!NT_STATUS_IS_OK(status)) {
- /* bad news, we must have hit a race - we don't delete the file
- here as the most likely scenario is that someone else created
- the file at the same time */
- close(fd);
- return status;
- }
-
-
f->ntvfs = h;
f->pvfs = pvfs;
f->pending_list = NULL;
@@ -723,6 +710,18 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
f->handle->sticky_write_time = false;
f->handle->open_completed = false;
+ status = odb_open_file(lck, f->handle, name->full_name,
+ &f->handle->fd, allow_level_II_oplock,
+ oplock_level, &oplock_granted);
+ talloc_free(lck);
+ if (!NT_STATUS_IS_OK(status)) {
+ /* bad news, we must have hit a race - we don't delete the file
+ here as the most likely scenario is that someone else created
+ the file at the same time */
+ close(fd);
+ return status;
+ }
+
DLIST_ADD(pvfs->files.list, f);
/* setup a destructor to avoid file descriptor leaks on
@@ -1297,9 +1296,24 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return status;
}
+ if (access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) {
+ flags |= O_RDWR;
+ } else {
+ flags |= O_RDONLY;
+ }
+
+ /* do the actual open */
+ fd = open(f->handle->name->full_name, flags);
+ if (fd == -1) {
+ talloc_free(lck);
+ return pvfs_map_errno(f->pvfs, errno);
+ }
+
+ f->handle->fd = fd;
+
/* now really mark the file as open */
status = odb_open_file(lck, f->handle, name->full_name,
- allow_level_II_oplock,
+ &f->handle->fd, allow_level_II_oplock,
oplock_level, &oplock_granted);
if (!NT_STATUS_IS_OK(status)) {
@@ -1319,21 +1333,6 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
f->handle->have_opendb_entry = true;
- if (access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) {
- flags |= O_RDWR;
- } else {
- flags |= O_RDONLY;
- }
-
- /* do the actual open */
- fd = open(f->handle->name->full_name, flags);
- if (fd == -1) {
- talloc_free(lck);
- return pvfs_map_errno(f->pvfs, errno);
- }
-
- f->handle->fd = fd;
-
stream_existed = name->stream_exists;
/* if this was a stream create then create the stream as well */