• Casey Schaufler's avatar
    Smack:- Remove mutex lock "smk_lock" from inode_smack · 921bb1cb
    Casey Schaufler authored
    "smk_lock" mutex is used during inode instantiation in
    smack_d_instantiate()function. It has been used to avoid
    simultaneous access on same inode security structure.
    Since smack related initialization is done only once i.e during
    inode creation. If the inode has already been instantiated then
    smack_d_instantiate() function just returns without doing
    anything.
    
    So it means mutex lock is required only during inode creation.
    But since 2 processes can't create same inodes or files
    simultaneously. Also linking or some other file operation can't
    be done simultaneously when the file is getting created since
    file lookup will fail before dentry inode linkup which is done
    after smack initialization.
    So no mutex lock is required in inode_smack structure.
    
    It will save memory as well as improve some performance.
    If 40000 inodes are created in system, it will save 1.5 MB on
    32-bit systems & 2.8 MB on 64-bit systems.
    Signed-off-by: default avatarVishal Goel <vishal.goel@samsung.com>
    Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
    Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
    921bb1cb
smack_lsm.c 116 KB