summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-02-28 12:19:18 +0100
committerStefan Metzmacher <metze@samba.org>2008-02-29 15:17:53 +0100
commit176e20bf2662838cbc28d42c342a4d442f6bc308 (patch)
treea73b39e18621d2c4968eca5eb8f518433c876274 /source4/ntvfs/posix
parentdaa4dec695b53e0c7ea442b6ca0b012f128ed759 (diff)
downloadsamba-176e20bf2662838cbc28d42c342a4d442f6bc308.tar.gz
samba-176e20bf2662838cbc28d42c342a4d442f6bc308.tar.bz2
samba-176e20bf2662838cbc28d42c342a4d442f6bc308.zip
pvfs_setfileinfo: tell the opendb about renames
metze (This used to be commit 9360eda2c5606b2c73edb768af8ca0e8ba310e30)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index fcadbfd852..18647c95c5 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -82,11 +82,13 @@ static uint32_t pvfs_setfileinfo_access(union smb_setfileinfo *info)
static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
struct ntvfs_request *req,
struct pvfs_filename *name,
+ DATA_BLOB *odb_locking_key,
union smb_setfileinfo *info)
{
NTSTATUS status;
struct pvfs_filename *name2;
char *new_name, *p;
+ struct odb_lock *lck = NULL;
/* renames are only allowed within a directory */
if (strchr_m(info->rename_information.in.new_name, '\\') &&
@@ -168,8 +170,19 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
return status;
}
+ lck = odb_lock(req, pvfs->odb_context, odb_locking_key);
+ if (lck == NULL) {
+ DEBUG(0,("Unable to lock opendb for can_stat\n"));
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
status = pvfs_do_rename(pvfs, name, name2->full_name);
if (NT_STATUS_IS_OK(status)) {
+ status = odb_rename(lck, name2->full_name);
+ }
+ talloc_free(lck);
+ NT_STATUS_NOT_OK_RETURN(status);
+ if (NT_STATUS_IS_OK(status)) {
name->full_name = talloc_steal(name, name2->full_name);
name->original_name = talloc_steal(name, name2->original_name);
}
@@ -391,7 +404,8 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_RENAME_INFORMATION:
case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
- return pvfs_setfileinfo_rename(pvfs, req, h->name,
+ return pvfs_setfileinfo_rename(pvfs, req, h->name,
+ &h->odb_locking_key,
info);
case RAW_SFILEINFO_SEC_DESC:
@@ -565,6 +579,7 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
uint32_t access_needed;
uint32_t change_mask = 0;
struct odb_lock *lck = NULL;
+ DATA_BLOB odb_locking_key;
/* resolve the cifs name to a posix name */
status = pvfs_resolve_name(pvfs, req, info->generic.in.file.path,
@@ -696,8 +711,12 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_RENAME_INFORMATION:
case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
- return pvfs_setfileinfo_rename(pvfs, req, name,
- info);
+ status = pvfs_locking_key(name, name, &odb_locking_key);
+ NT_STATUS_NOT_OK_RETURN(status);
+ status = pvfs_setfileinfo_rename(pvfs, req, name,
+ &odb_locking_key, info);
+ NT_STATUS_NOT_OK_RETURN(status);
+ return NT_STATUS_OK;
case RAW_SFILEINFO_DISPOSITION_INFO:
case RAW_SFILEINFO_DISPOSITION_INFORMATION: