Skip to content
  • Martin Brandenburg's avatar
    orangefs: reorganize setattr functions to track attribute changes · afd9fb2a
    Martin Brandenburg authored
    
    
    OrangeFS accepts a mask indicating which attributes were changed.  The
    kernel must not set any bits except those that were actually changed.
    The kernel must set the uid/gid of the request to the actual uid/gid
    responsible for the change.
    
    Code path for notify_change initiated setattrs is
    
    orangefs_setattr(dentry, iattr)
    -> __orangefs_setattr(inode, iattr)
    
    In kernel changes are initiated by calling __orangefs_setattr.
    
    Code path for writeback is
    
    orangefs_write_inode
    -> orangefs_inode_setattr
    
    attr_valid and attr_uid and attr_gid change together under i_lock.
    I_DIRTY changes separately.
    
    __orangefs_setattr
    	lock
    	if needs to be cleaned first, unlock and retry
    	set attr_valid
    	copy data in
    	unlock
    	mark_inode_dirty
    
    orangefs_inode_setattr
    	lock
    	copy attributes out
    	unlock
    	clear getattr_time
    	# __writeback_single_inode clears dirty
    
    orangefs_inode_getattr
    	# possible to get here with attr_valid set and not dirty
    	lock
    	if getattr_time ok or attr_valid set, unlock and return
    	unlock
    	do server operation
    	# another thread may getattr or setattr, so check for that
    	lock
    	if getattr_time ok or attr_valid, unlock and return
    	else, copy in
    	update getattr_time
    	unlock
    
    Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
    Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
    afd9fb2a