summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-01 10:05:25 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-01 10:29:56 +0100
commit0de1a63c18a83fd97938816fe869c42cbe92aac9 (patch)
treeba8e8d558cfecda937404a5b8f664be65055a3bf /source4
parent2bb8e49a7e8f38f053fb3d282ec62cfa4b52196e (diff)
downloadsamba-0de1a63c18a83fd97938816fe869c42cbe92aac9.tar.gz
samba-0de1a63c18a83fd97938816fe869c42cbe92aac9.tar.bz2
samba-0de1a63c18a83fd97938816fe869c42cbe92aac9.zip
pvfs_rename: move odb_rename() onto pvfs_do_rename()
metze (This used to be commit 5a1f0c0ce995064c23e9f726bceddbd8442c4293)
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/posix/pvfs_rename.c25
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c5
2 files changed, 13 insertions, 17 deletions
diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c
index 185e35f800..29b2d03005 100644
--- a/source4/ntvfs/posix/pvfs_rename.c
+++ b/source4/ntvfs/posix/pvfs_rename.c
@@ -28,16 +28,22 @@
/*
do a file rename, and send any notify triggers
*/
-NTSTATUS pvfs_do_rename(struct pvfs_state *pvfs, const struct pvfs_filename *name1,
+NTSTATUS pvfs_do_rename(struct pvfs_state *pvfs,
+ struct odb_lock *lck,
+ const struct pvfs_filename *name1,
const char *name2)
{
const char *r1, *r2;
uint32_t mask;
+ NTSTATUS status;
if (rename(name1->full_name, name2) == -1) {
return pvfs_map_errno(pvfs, errno);
}
+ status = odb_rename(lck, name2);
+ NT_STATUS_NOT_OK_RETURN(status);
+
if (name1->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
mask = FILE_NOTIFY_CHANGE_DIR_NAME;
} else {
@@ -315,11 +321,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
return NT_STATUS_NO_MEMORY;
}
- status = pvfs_do_rename(pvfs, name1, fname2);
-
- if (NT_STATUS_IS_OK(status)) {
- status = odb_rename(lck, fname2);
- }
+ status = pvfs_do_rename(pvfs, lck, name1, fname2);
failed:
talloc_free(mem_ctx);
@@ -448,9 +450,9 @@ static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs,
return status;
}
- status = pvfs_do_rename(pvfs, name1, name2->full_name);
- if (NT_STATUS_IS_OK(status)) {
- status = odb_rename(lck, name2->full_name);
+ status = pvfs_do_rename(pvfs, lck, name1, name2->full_name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
return NT_STATUS_OK;
@@ -532,10 +534,7 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs,
case RENAME_FLAG_RENAME:
status = pvfs_access_check_parent(pvfs, req, name2, SEC_DIR_ADD_FILE);
NT_STATUS_NOT_OK_RETURN(status);
- status = pvfs_do_rename(pvfs, name1, name2->full_name);
- if (NT_STATUS_IS_OK(status)) {
- status = odb_rename(lck, name2->full_name);
- }
+ status = pvfs_do_rename(pvfs, lck, name1, name2->full_name);
NT_STATUS_NOT_OK_RETURN(status);
break;
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 5ac9cedc48..ad47fe90c9 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -171,10 +171,7 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
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);
- }
+ status = pvfs_do_rename(pvfs, lck, name, name2->full_name);
talloc_free(lck);
NT_STATUS_NOT_OK_RETURN(status);
if (NT_STATUS_IS_OK(status)) {