svn commit: samba r3595 - in branches/SAMBA_4_0/source/ntvfs/posix:
.
tridge at samba.org
tridge at samba.org
Sun Nov 7 10:05:36 GMT 2004
Author: tridge
Date: 2004-11-07 10:05:35 +0000 (Sun, 07 Nov 2004)
New Revision: 3595
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3595
Log:
- fixed a talloc_free ordering problem on cleanup with pending requests
- added initial support for MODE_INFORMATION in setfileinfo (I have no
idea what "mode information" on a file is - it takes a value of 0,
2, 4 or 6. What could it be?)
Modified:
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_wait.c
branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h
Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c 2004-11-07 10:03:56 UTC (rev 3594)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c 2004-11-07 10:05:35 UTC (rev 3595)
@@ -295,7 +295,7 @@
if (lck->lockx.in.timeout != 0 &&
(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
- pending = talloc_p(req, struct pvfs_pending_lock);
+ pending = talloc_p(f, struct pvfs_pending_lock);
if (pending == NULL) {
return NT_STATUS_NO_MEMORY;
}
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-11-07 10:03:56 UTC (rev 3594)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-11-07 10:05:35 UTC (rev 3595)
@@ -142,6 +142,7 @@
f->share_access = io->generic.in.share_access;
f->seek_offset = 0;
f->position = 0;
+ f->mode = 0;
DLIST_ADD(pvfs->open_files, f);
@@ -362,6 +363,7 @@
}
status = odb_open_file(lck, fnum, share_access, create_options, access_mask);
+ talloc_free(lck);
if (!NT_STATUS_IS_OK(status)) {
/* bad news, we must have hit a race */
idr_remove(pvfs->idtree_fnum, fnum);
@@ -382,6 +384,7 @@
f->access_mask = access_mask;
f->seek_offset = 0;
f->position = 0;
+ f->mode = 0;
f->have_opendb_entry = True;
DLIST_ADD(pvfs->open_files, f);
@@ -433,6 +436,7 @@
if (lck != NULL) {
odb_remove_pending(lck, r);
}
+ talloc_free(lck);
}
return 0;
}
@@ -768,6 +772,7 @@
}
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
@@ -776,6 +781,7 @@
/* do the actual open */
fd = open(f->name->full_name, flags);
if (fd == -1) {
+ talloc_free(lck);
return pvfs_map_errno(f->pvfs, errno);
}
@@ -784,6 +790,7 @@
/* re-resolve the open fd */
status = pvfs_resolve_name_fd(f->pvfs, fd, f->name);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
@@ -793,15 +800,18 @@
uint32_t attrib = io->ntcreatex.in.file_attr | FILE_ATTRIBUTE_ARCHIVE;
mode_t mode = pvfs_fileperms(pvfs, attrib);
if (fchmod(fd, mode) == -1) {
+ talloc_free(lck);
return map_nt_error_from_unix(errno);
}
name->dos.attrib = attrib;
status = pvfs_dosattrib_save(pvfs, name, fd);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
return status;
}
}
+ talloc_free(lck);
io->generic.out.oplock_level = NO_OPLOCK;
io->generic.out.fnum = f->fnum;
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c 2004-11-07 10:03:56 UTC (rev 3594)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c 2004-11-07 10:05:35 UTC (rev 3595)
@@ -171,6 +171,9 @@
case RAW_SFILEINFO_ALLOCATION_INFO:
case RAW_SFILEINFO_ALLOCATION_INFORMATION:
newstats.dos.alloc_size = info->allocation_info.in.alloc_size;
+ if (newstats.dos.alloc_size < newstats.st.st_size) {
+ newstats.st.st_size = newstats.dos.alloc_size;
+ }
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
@@ -182,6 +185,17 @@
f->position = info->position_information.in.position;
break;
+ case RAW_SFILEINFO_MODE_INFORMATION:
+ /* this one is a puzzle */
+ if (info->mode_information.in.mode != 0 &&
+ info->mode_information.in.mode != 2 &&
+ info->mode_information.in.mode != 4 &&
+ info->mode_information.in.mode != 6) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ f->mode = info->mode_information.in.mode;
+ break;
+
default:
return NT_STATUS_INVALID_LEVEL;
}
@@ -310,7 +324,15 @@
case RAW_SFILEINFO_ALLOCATION_INFO:
case RAW_SFILEINFO_ALLOCATION_INFORMATION:
+ if (info->allocation_info.in.alloc_size > newstats.dos.alloc_size) {
+ /* strange. Increasing the allocation size via setpathinfo
+ should be silently ignored */
+ break;
+ }
newstats.dos.alloc_size = info->allocation_info.in.alloc_size;
+ if (newstats.dos.alloc_size < newstats.st.st_size) {
+ newstats.st.st_size = newstats.dos.alloc_size;
+ }
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
@@ -318,6 +340,15 @@
newstats.st.st_size = info->end_of_file_info.in.size;
break;
+ case RAW_SFILEINFO_MODE_INFORMATION:
+ if (info->mode_information.in.mode != 0 &&
+ info->mode_information.in.mode != 2 &&
+ info->mode_information.in.mode != 4 &&
+ info->mode_information.in.mode != 6) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ return NT_STATUS_OK;
+
case RAW_SFILEINFO_DISPOSITION_INFO:
case RAW_SFILEINFO_DISPOSITION_INFORMATION:
case RAW_SFILEINFO_POSITION_INFORMATION:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_wait.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_wait.c 2004-11-07 10:03:56 UTC (rev 3594)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_wait.c 2004-11-07 10:05:35 UTC (rev 3595)
@@ -137,7 +137,7 @@
pwait->msg_ctx = pvfs->tcon->smb_conn->connection->messaging_ctx;
pwait->ev = req->tcon->smb_conn->connection->event.ctx;
pwait->msg_type = msg_type;
- pwait->req = req;
+ pwait->req = talloc_reference(pwait, req);
pwait->pvfs = pvfs;
/* setup a timer */
@@ -162,10 +162,6 @@
/* make sure we cleanup the timer and message handler */
talloc_set_destructor(pwait, pvfs_wait_destructor);
- /* make sure that on a disconnect the request is not destroyed
- before pvfs */
- talloc_steal(pvfs, req);
-
return pwait;
}
Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h 2004-11-07 10:03:56 UTC (rev 3594)
+++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h 2004-11-07 10:05:35 UTC (rev 3595)
@@ -116,6 +116,9 @@
uint32_t share_access;
uint32_t access_mask;
+ /* this is set by the mode_information level. What does it do? */
+ uint32_t mode;
+
/* yes, we need 2 independent positions ... */
uint64_t seek_offset;
uint64_t position;
More information about the samba-cvs
mailing list