diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-05-20 08:01:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:52:39 -0500 |
commit | e3036006fe99893eb6c4f69ca2e70e48d35e8f24 (patch) | |
tree | 8ecfd4511729dc5c3b5a757043e2eedc439542ac /source4/ntvfs/posix | |
parent | d2872b42f36ceac89970e3c1596300fa55ff7c50 (diff) | |
download | samba-e3036006fe99893eb6c4f69ca2e70e48d35e8f24.tar.gz samba-e3036006fe99893eb6c4f69ca2e70e48d35e8f24.tar.bz2 samba-e3036006fe99893eb6c4f69ca2e70e48d35e8f24.zip |
r23017: fixed the warning we have been getting for a long time:
pvfs_close: failed to delete XXX
during the BASE-DELETE test. It was a real bug, and could result in a
delete on close triggering for a handle that had never fully opened.
(This used to be commit 398c3724b4cd8c8073c8a77f8b0568d6b3ce1e7d)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 12 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index a0ef77b0ff..b737fa328a 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -270,6 +270,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, f->handle->position = 0; f->handle->mode = 0; f->handle->sticky_write_time = False; + f->handle->open_completed = False; if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) && pvfs_directory_empty(pvfs, f->handle->name)) { @@ -379,6 +380,8 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, goto cleanup_delete; } + f->handle->open_completed = True; + io->generic.out.oplock_level = OPLOCK_NONE; io->generic.out.file.ntvfs = h; io->generic.out.create_action = create_action; @@ -437,6 +440,7 @@ static int pvfs_handle_destructor(struct pvfs_file_handle *h) } if (h->name->stream_name == NULL && + h->open_completed && pvfs_delete_on_close_set(h->pvfs, h, &open_count, &path) && open_count == 1) { NTSTATUS status; @@ -701,6 +705,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, f->handle->mode = 0; f->handle->have_opendb_entry = True; f->handle->sticky_write_time = False; + f->handle->open_completed = False; DLIST_ADD(pvfs->files.list, f); @@ -729,6 +734,8 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, goto cleanup_delete; } + f->handle->open_completed = True; + notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, FILE_NOTIFY_CHANGE_FILE_NAME, @@ -1129,6 +1136,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, f->handle->mode = 0; f->handle->have_opendb_entry = False; f->handle->sticky_write_time = False; + f->handle->open_completed = False; /* form the lock context used for byte range locking and opendb locking */ @@ -1264,6 +1272,10 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, status = ntvfs_handle_set_backend_data(h, ntvfs, f); NT_STATUS_NOT_OK_RETURN(status); + /* mark the open as having completed fully, so delete on close + can now be used */ + f->handle->open_completed = True; + io->generic.out.oplock_level = oplock_granted; io->generic.out.file.ntvfs = h; io->generic.out.create_action = stream_existed? diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h index e79eadd03a..cff0206f61 100644 --- a/source4/ntvfs/posix/vfs_posix.h +++ b/source4/ntvfs/posix/vfs_posix.h @@ -150,6 +150,9 @@ struct pvfs_file_handle { /* have we set a sticky write time that we should remove on close */ BOOL sticky_write_time; + + /* the open went through to completion */ + BOOL open_completed; }; /* open file state */ |