Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 11: Extended Attributes and Access Control Lists


The course of action is basically identical with the previously considered case where the data were located
in the inode, but two modifications need to be made:

❑ The kernel needs to read the extended attribute block; the address is stored in thei_file_acl
element ofstruct ext3_inode_info.
❑ Metadata blocks are cached by callingext3_xattr_cache_insert. The kernel uses the so-called
filesystem metadata block cache implemented infs/mbcache.cfor this.^2 Since nothing really
unexpected happens there, it is not necessary to discuss the code in more detail.

Setting Extended Attributes


Setting extended attributes for theusernamespace is handled by — you guessed it —ext3_xattr_user_
set. As for the get operation, the function is just a wrapper for the generic helperext3_xattr_set.The
code flow diagram in Figure 11-8 shows that this is yet another wrapper function that is responsible for
handling the interaction with the journal. The real work is delegated toext3_xattr_set_handle;the
associated code flow diagram can be seen in Figure 11-9.

Get handle

Stop Journal

ext3_xattr_set

ext3_xattr_set_handle

Figure 11-8: Code flow diagram for
ext3_xattr_set.

Get inode location

Attibute not directly in inode?

Set attribute in the appropriate location

Update superblock and mark inode dirty

Yes

No

value == NULL?

ext3_xattr_set_handle

ext3_xattr_ibody_find

ext3_xattr_block_find

ext3_xattr_{ibody,block}_set

Figure 11-9: Code flow diagram forext3_xattr_set.

(^2) Although the structure of this cache is generic, it is currently only used by the extended filesystem family.

Free download pdf