pvfs: pass NULL to pvfs_can_*() when no odb_lock is needed by the caller
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Feb 2008 18:59:13 +0000 (19:59 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 25 Feb 2008 06:56:06 +0000 (07:56 +0100)
metze

source/ntvfs/posix/pvfs_rename.c
source/ntvfs/posix/pvfs_setfileinfo.c
source/ntvfs/posix/pvfs_unlink.c

index ea12f49333e4bf6cad5df6de4ad2a71cc18c3dfb..5693e793141c7e51854092e5085eb34037bb66ab 100644 (file)
@@ -192,8 +192,8 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
 {
        struct pvfs_filename *name1, *name2;
        TALLOC_CTX *mem_ctx = talloc_new(req);
+       struct odb_lock *lck = NULL;
        NTSTATUS status;
-       struct odb_lock *lck, *lck2;
 
        /* resolve the wildcard pattern for this name */
        fname2 = pvfs_resolve_wildcard(mem_ctx, fname1, fname2);
@@ -216,6 +216,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
 
        status = pvfs_can_rename(pvfs, req, name1, &lck);
        if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(lck);
                goto failed;
        }
 
@@ -223,7 +224,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
        status = pvfs_resolve_partial(pvfs, mem_ctx, 
                                      dir_path, fname2, &name2);
        if (NT_STATUS_IS_OK(status)) {
-               status = pvfs_can_delete(pvfs, req, name2, &lck2);
+               status = pvfs_can_delete(pvfs, req, name2, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        goto failed;
                }
@@ -311,7 +312,7 @@ static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs,
        struct pvfs_state *pvfs = ntvfs->private_data;
        NTSTATUS status;
        struct pvfs_filename *name1, *name2;
-       struct odb_lock *lck;
+       struct odb_lock *lck = NULL;
 
        /* resolve the cifs name to a posix name */
        status = pvfs_resolve_name(pvfs, req, ren->rename.in.pattern1, 
@@ -354,6 +355,7 @@ static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs,
 
        status = pvfs_can_rename(pvfs, req, name1, &lck);
        if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(lck);
                return status;
        }
 
@@ -375,7 +377,6 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs,
        struct pvfs_state *pvfs = ntvfs->private_data;
        NTSTATUS status;
        struct pvfs_filename *name1, *name2;
-       struct odb_lock *lck;
 
        switch (ren->ntrename.in.flags) {
        case RENAME_FLAG_RENAME:
@@ -421,7 +422,7 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs,
                return status;
        }
 
-       status = pvfs_can_rename(pvfs, req, name1, &lck);
+       status = pvfs_can_rename(pvfs, req, name1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index 9c78699edb71d4626cebfa73efe44a9dc3627749..fbbb8c2d4baeb3b1ab85a5c5171377d7add6ddee 100644 (file)
@@ -142,8 +142,6 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
 
        /* if the destination exists, then check the rename is allowed */
        if (name2->exists) {
-               struct odb_lock *lck;
-
                if (strcmp(name2->full_name, name->full_name) == 0) {
                        /* rename to same name is null-op */
                        return NT_STATUS_OK;
@@ -153,7 +151,7 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
                        return NT_STATUS_OBJECT_NAME_COLLISION;
                }
 
-               status = pvfs_can_delete(pvfs, req, name2, &lck);
+               status = pvfs_can_delete(pvfs, req, name2, NULL);
                if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
                        return NT_STATUS_ACCESS_DENIED;
                }
index ef56d99fb559a2bca73cd0c477b4df8643389d9d..d6e60b59d346bfbadeb3a660f1db6b152bcd8461 100644 (file)
@@ -33,7 +33,6 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs,
                                   uint16_t attrib)
 {
        NTSTATUS status;
-       struct odb_lock *lck;
 
        if (!name->stream_exists) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -45,7 +44,7 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs,
                return status;
        }
 
-       status = pvfs_can_delete(pvfs, req, name, &lck);
+       status = pvfs_can_delete(pvfs, req, name, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -64,7 +63,6 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
 {
        struct pvfs_filename *name;
        NTSTATUS status;
-       struct odb_lock *lck;
 
        /* get a pvfs_filename object */
        status = pvfs_resolve_partial(pvfs, req, 
@@ -80,7 +78,7 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
                return status;
        }
 
-       status = pvfs_can_delete(pvfs, req, name, &lck);
+       status = pvfs_can_delete(pvfs, req, name, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(name);
                return status;