[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Dec 16 15:42:01 MST 2010
The branch, master has been updated
via 34c0d01 Do more vfs_stat_fsp calls instead of FSTAT - ensures fsp->fsp_name->st is kept up to date.
from ba21b6e s4-waf: nsstest only needs replace.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 34c0d016d78aed3c631577329918fb0b8a27d921
Author: Jeremy Allison <jra at samba.org>
Date: Thu Dec 16 13:52:59 2010 -0800
Do more vfs_stat_fsp calls instead of FSTAT - ensures fsp->fsp_name->st is kept up to date.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Thu Dec 16 23:41:06 CET 2010 on sn-devel-104
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_default.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 648aa34..66dd5a9 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -821,35 +821,39 @@ static int vfswrap_ntimes(vfs_handle_struct *handle,
static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
{
- SMB_STRUCT_STAT st;
SMB_OFF_T space_to_write;
uint64_t space_avail;
uint64_t bsize,dfree,dsize;
int ret;
+ NTSTATUS status;
+ SMB_STRUCT_STAT *pst;
- if (SMB_VFS_FSTAT(fsp, &st) == -1)
+ status = vfs_stat_fsp(fsp);
+ if (!NT_STATUS_IS_OK(status)) {
return -1;
+ }
+ pst = &fsp->fsp_name->st;
#ifdef S_ISFIFO
- if (S_ISFIFO(st.st_ex_mode))
+ if (S_ISFIFO(pst->st_ex_mode))
return 0;
#endif
- if (st.st_ex_size == len)
+ if (pst->st_ex_size == len)
return 0;
/* Shrink - just ftruncate. */
- if (st.st_ex_size > len)
+ if (pst->st_ex_size > len)
return sys_ftruncate(fsp->fh->fd, len);
- space_to_write = len - st.st_ex_size;
+ space_to_write = len - pst->st_ex_size;
/* for allocation try posix_fallocate first. This can fail on some
platforms e.g. when the filesystem doesn't support it and no
emulation is being done by the libc (like on AIX with JFS1). In that
case we do our own emulation. posix_fallocate implementations can
return ENOTSUP or EINVAL in cases like that. */
- ret = SMB_VFS_POSIX_FALLOCATE(fsp, st.st_ex_size, space_to_write);
+ ret = SMB_VFS_POSIX_FALLOCATE(fsp, pst->st_ex_size, space_to_write);
if (ret == ENOSPC) {
errno = ENOSPC;
return -1;
@@ -872,7 +876,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
}
/* Write out the real space on disk. */
- ret = vfs_slow_fallocate(fsp, st.st_ex_size, space_to_write);
+ ret = vfs_slow_fallocate(fsp, pst->st_ex_size, space_to_write);
if (ret != 0) {
errno = ret;
ret = -1;
@@ -884,7 +888,8 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
{
int result = -1;
- SMB_STRUCT_STAT st;
+ SMB_STRUCT_STAT *pst;
+ NTSTATUS status;
char c = 0;
START_PROFILE(syscall_ftruncate);
@@ -913,23 +918,25 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O
size in which case the ftruncate above should have
succeeded or shorter, in which case seek to len - 1 and
write 1 byte of zero */
- if (SMB_VFS_FSTAT(fsp, &st) == -1) {
+ status = vfs_stat_fsp(fsp);
+ if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ pst = &fsp->fsp_name->st;
#ifdef S_ISFIFO
- if (S_ISFIFO(st.st_ex_mode)) {
+ if (S_ISFIFO(pst->st_ex_mode)) {
result = 0;
goto done;
}
#endif
- if (st.st_ex_size == len) {
+ if (pst->st_ex_size == len) {
result = 0;
goto done;
}
- if (st.st_ex_size > len) {
+ if (pst->st_ex_size > len) {
/* the sys_ftruncate should have worked */
goto done;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list