]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
When mapping EA's into a TDB, don't remove the EA
authorJeremy Allison <jra@samba.org>
Wed, 12 Aug 2009 23:27:17 +0000 (16:27 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 12 Aug 2009 23:27:17 +0000 (16:27 -0700)
until the last link to the file is gone (fixes the
build farm RAW-RENAME test with xattr's in tdb's).
Jeremy.

source3/modules/vfs_xattr_tdb.c

index a058c824e75a45ecd54cc8d233127574211d8c0b..55fb1417b71f35348963c53f7e92c842539f5bce 100644 (file)
@@ -620,6 +620,7 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
        struct db_record *rec;
        NTSTATUS status;
        int ret = -1;
+       bool remove_record = false;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
@@ -632,6 +633,10 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
        if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) == -1) {
                goto out;
        }
+       if (smb_fname_tmp->st.st_ex_nlink == 1) {
+               /* Only remove record on last link to file. */
+               remove_record = true;
+       }
 
        ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname_tmp);
 
@@ -639,6 +644,10 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
                goto out;
        }
 
+       if (!remove_record) {
+               goto out;
+       }
+
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, &smb_fname_tmp->st);
 
        rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);