/** * sysfs_addrm_finish - finish up sysfs_dirent add/remove * @acxt: addrm context to finish up * * Finish up sysfs_dirent add/remove. Resources acquired by * sysfs_addrm_start() are released and removed sysfs_dirents are * cleaned up. Timestamps on the parent inode are updated. * * LOCKING: * All mutexes acquired by sysfs_addrm_start() are released. * * RETURNS: * Number of added/removed sysfs_dirents since sysfs_addrm_start(). */ int sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) { /* release resources acquired by sysfs_addrm_start() */ mutex_unlock(&sysfs_mutex); if (acxt->parent_inode) { struct inode *inode = acxt->parent_inode; /* if added/removed, update timestamps on the parent */ if (acxt->cnt) inode->i_ctime = inode->i_mtime = CURRENT_TIME; mutex_unlock(&inode->i_mutex); iput(inode); } /* kill removed sysfs_dirents */ while (acxt->removed) { struct sysfs_dirent *sd = acxt->removed; acxt->removed = sd->s_sibling; sd->s_sibling = NULL; sysfs_drop_dentry(sd); sysfs_deactivate(sd); sysfs_put(sd); } return acxt->cnt; }
/** * sysfs_addrm_finish - finish up sysfs_dirent add/remove * @acxt: addrm context to finish up * * Finish up sysfs_dirent add/remove. Resources acquired by * sysfs_addrm_start() are released and removed sysfs_dirents are * cleaned up. * * LOCKING: * sysfs_mutex is released. */ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) { /* release resources acquired by sysfs_addrm_start() */ mutex_unlock(&sysfs_mutex); /* kill removed sysfs_dirents */ while (acxt->removed) { struct sysfs_dirent *sd = acxt->removed; acxt->removed = sd->s_sibling; sd->s_sibling = NULL; sysfs_deactivate(sd); unmap_bin_file(sd); sysfs_put(sd); } }