FreeBSD ZFS
The Zettabyte File System
|
FUIDs cause problems for the intent log we need to replay the creation of the FUID, but we can't count on the idmapper to be around and during replay the FUID index may be different than before. More...
#include <sys/types.h>
#include <sys/kidmap.h>
#include <sys/dmu.h>
#include <sys/zfs_vfsops.h>
#include <sys/avl.h>
#include <sys/list.h>
Go to the source code of this file.
Data Structures | |
struct | zfs_fuid |
The FUIDs in the log will index into domain string table and the bottom half will be the rid. More... | |
struct | zfs_fuid_domain |
list of unique domains More... | |
struct | zfs_fuid_info |
FUID information necessary for logging create, setattr, and setacl. More... | |
Defines | |
#define | FUID_SIZE_ESTIMATE(z) ((z)->z_fuid_size + (SPA_MINBLOCKSIZE << 1)) |
Estimate space needed for one more fuid table entry. | |
#define | FUID_INDEX(x) ((x) >> 32) |
#define | FUID_RID(x) ((x) & 0xffffffff) |
#define | FUID_ENCODE(idx, rid) (((uint64_t)(idx) << 32) | (rid)) |
Typedefs | |
typedef struct zfs_fuid | zfs_fuid_t |
The FUIDs in the log will index into domain string table and the bottom half will be the rid. | |
typedef struct zfs_fuid_domain | zfs_fuid_domain_t |
list of unique domains | |
typedef struct zfs_fuid_info | zfs_fuid_info_t |
FUID information necessary for logging create, setattr, and setacl. | |
Enumerations | |
enum | zfs_fuid_type_t { ZFS_OWNER, ZFS_GROUP, ZFS_ACE_USER, ZFS_ACE_GROUP } |
Functions | |
uid_t | zfs_fuid_map_id (zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t) |
void | zfs_fuid_node_add (zfs_fuid_info_t **, const char *, uint32_t, uint64_t, uint64_t, zfs_fuid_type_t) |
Add a FUID node to the list of fuid's being created for this ACL. | |
void | zfs_fuid_destroy (zfsvfs_t *) |
uint64_t | zfs_fuid_create_cred (zfsvfs_t *, zfs_fuid_type_t, cred_t *, zfs_fuid_info_t **) |
Create a file system FUID, based on information in the users cred. | |
uint64_t | zfs_fuid_create (zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t, zfs_fuid_info_t **) |
Create a file system FUID for an ACL ace or a chown/chgrp of the file. | |
void | zfs_fuid_map_ids (struct znode *zp, cred_t *cr, uid_t *uid, uid_t *gid) |
zfs_fuid_info_t * | zfs_fuid_info_alloc (void) |
Allocate zfs_fuid_info for tracking FUIDs created during zfs_mknode, VOP_SETATTR() or VOP_SETSECATTR() | |
void | zfs_fuid_info_free (zfs_fuid_info_t *) |
Release all memory associated with zfs_fuid_info_t. | |
boolean_t | zfs_groupmember (zfsvfs_t *, uint64_t, cred_t *) |
Check to see if id is a groupmember. | |
void | zfs_fuid_sync (zfsvfs_t *, dmu_tx_t *) |
sync out AVL trees to persistent storage. | |
int | zfs_fuid_find_by_domain (zfsvfs_t *, const char *domain, char **retdomain, boolean_t addok) |
Query domain table for a given domain. | |
const char * | zfs_fuid_find_by_idx (zfsvfs_t *zfsvfs, uint32_t idx) |
Query domain table by index, returning domain string. | |
void | zfs_fuid_txhold (zfsvfs_t *zfsvfs, dmu_tx_t *tx) |
char * | zfs_fuid_idx_domain (avl_tree_t *, uint32_t) |
void | zfs_fuid_avl_tree_create (avl_tree_t *, avl_tree_t *) |
uint64_t | zfs_fuid_table_load (objset_t *, uint64_t, avl_tree_t *, avl_tree_t *) |
load initial fuid domain and idx trees. | |
void | zfs_fuid_table_destroy (avl_tree_t *, avl_tree_t *) |
FUIDs cause problems for the intent log we need to replay the creation of the FUID, but we can't count on the idmapper to be around and during replay the FUID index may be different than before.
Also, if an ACL has 100 ACEs and 12 different domains we don't want to log 100 domain strings, but rather just the unique 12.
Definition in file zfs_fuid.h.
#define FUID_ENCODE | ( | idx, | |
rid | |||
) | (((uint64_t)(idx) << 32) | (rid)) |
Definition at line 57 of file zfs_fuid.h.
#define FUID_INDEX | ( | x | ) | ((x) >> 32) |
Definition at line 55 of file zfs_fuid.h.
#define FUID_RID | ( | x | ) | ((x) & 0xffffffff) |
Definition at line 56 of file zfs_fuid.h.
#define FUID_SIZE_ESTIMATE | ( | z | ) | ((z)->z_fuid_size + (SPA_MINBLOCKSIZE << 1)) |
Estimate space needed for one more fuid table entry.
For now assume its current size + 1K
Definition at line 53 of file zfs_fuid.h.
typedef struct zfs_fuid_domain zfs_fuid_domain_t |
list of unique domains
typedef struct zfs_fuid_info zfs_fuid_info_t |
FUID information necessary for logging create, setattr, and setacl.
typedef struct zfs_fuid zfs_fuid_t |
The FUIDs in the log will index into domain string table and the bottom half will be the rid.
Used for mapping ephemeral uid/gid during ACL setting to FUIDs
enum zfs_fuid_type_t |
Definition at line 42 of file zfs_fuid.h.
void zfs_fuid_avl_tree_create | ( | avl_tree_t * | , |
avl_tree_t * | |||
) |
Definition at line 102 of file zfs_fuid.c.
uint64_t zfs_fuid_create | ( | zfsvfs_t * | zfsvfs, |
uint64_t | id, | ||
cred_t * | cr, | ||
zfs_fuid_type_t | type, | ||
zfs_fuid_info_t ** | fuidpp | ||
) |
Create a file system FUID for an ACL ace or a chown/chgrp of the file.
This is similar to zfs_fuid_create_cred, except that we can't find the domain + rid information in the cred. Instead we have to query Winchester for the domain and rid.
During replay operations the domain+rid information is found in the zfs_fuid_info_t that the replay code has attached to the zfsvfs of the file system.
Definition at line 556 of file zfs_fuid.c.
uint64_t zfs_fuid_create_cred | ( | zfsvfs_t * | zfsvfs, |
zfs_fuid_type_t | type, | ||
cred_t * | cr, | ||
zfs_fuid_info_t ** | fuidp | ||
) |
Create a file system FUID, based on information in the users cred.
If cred contains KSID_OWNER then it should be used to determine the uid otherwise cred's uid will be used. By default cred's gid is used unless it's an ephemeral ID in which case KSID_GROUP will be used if it exists.
Definition at line 499 of file zfs_fuid.c.
void zfs_fuid_destroy | ( | zfsvfs_t * | ) |
Definition at line 640 of file zfs_fuid.c.
int zfs_fuid_find_by_domain | ( | zfsvfs_t * | zfsvfs, |
const char * | domain, | ||
char ** | retdomain, | ||
boolean_t | addok | ||
) |
Query domain table for a given domain.
If domain isn't found and addok is set, it is added to AVL trees and the zfsvfs->z_fuid_dirty flag will be set to TRUE. It will then be necessary for the caller or another thread to detect the dirty table and sync out the changes.
Definition at line 302 of file zfs_fuid.c.
const char* zfs_fuid_find_by_idx | ( | zfsvfs_t * | zfsvfs, |
uint32_t | idx | ||
) |
Query domain table by index, returning domain string.
Definition at line 367 of file zfs_fuid.c.
char* zfs_fuid_idx_domain | ( | avl_tree_t * | , |
uint32_t | |||
) |
Definition at line 183 of file zfs_fuid.c.
zfs_fuid_info_t* zfs_fuid_info_alloc | ( | void | ) |
Allocate zfs_fuid_info for tracking FUIDs created during zfs_mknode, VOP_SETATTR() or VOP_SETSECATTR()
Definition at line 656 of file zfs_fuid.c.
void zfs_fuid_info_free | ( | zfs_fuid_info_t * | ) |
Release all memory associated with zfs_fuid_info_t.
Definition at line 672 of file zfs_fuid.c.
uid_t zfs_fuid_map_id | ( | zfsvfs_t * | , |
uint64_t | , | ||
cred_t * | , | ||
zfs_fuid_type_t | |||
) |
Definition at line 397 of file zfs_fuid.c.
void zfs_fuid_map_ids | ( | struct znode * | zp, |
cred_t * | cr, | ||
uid_t * | uid, | ||
uid_t * | gid | ||
) |
Definition at line 390 of file zfs_fuid.c.
void zfs_fuid_node_add | ( | zfs_fuid_info_t ** | fuidpp, |
const char * | domain, | ||
uint32_t | rid, | ||
uint64_t | idx, | ||
uint64_t | id, | ||
zfs_fuid_type_t | type | ||
) |
Add a FUID node to the list of fuid's being created for this ACL.
If ACL has multiple domains, then keep only one copy of each unique domain.
Definition at line 432 of file zfs_fuid.c.
sync out AVL trees to persistent storage.
Definition at line 227 of file zfs_fuid.c.
void zfs_fuid_table_destroy | ( | avl_tree_t * | , |
avl_tree_t * | |||
) |
Definition at line 166 of file zfs_fuid.c.
uint64_t zfs_fuid_table_load | ( | objset_t * | os, |
uint64_t | fuid_obj, | ||
avl_tree_t * | idx_tree, | ||
avl_tree_t * | domain_tree | ||
) |
load initial fuid domain and idx trees.
This function is used by both the kernel and zdb.
Definition at line 115 of file zfs_fuid.c.
Definition at line 752 of file zfs_fuid.c.
boolean_t zfs_groupmember | ( | zfsvfs_t * | zfsvfs, |
uint64_t | id, | ||
cred_t * | cr | ||
) |
Check to see if id is a groupmember.
If cred has ksid info then sidlist is checked first and if still not found then POSIX groups are checked
Will use a straight FUID compare when possible.
Definition at line 702 of file zfs_fuid.c.