Re: [PATCH 3/4] configfs: implement committable items

From: kernel test robot
Date: Wed Nov 25 2020 - 13:11:29 EST


Hi Bartosz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc5 next-20201125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/configfs-implement-committable-items-and-add-sample-code/20201125-232501
base: git://git.infradead.org/users/hch/configfs.git for-next
config: arm-randconfig-r031-20201125 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/9ddc94acfed5f87493359f719d6eb5c259b6bd6d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bartosz-Golaszewski/configfs-implement-committable-items-and-add-sample-code/20201125-232501
git checkout 9ddc94acfed5f87493359f719d6eb5c259b6bd6d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/configfs/dir.c: In function 'configfs_rename':
>> fs/configfs/dir.c:1714:26: warning: variable 'committable_group_sd' set but not used [-Wunused-but-set-variable]
1714 | struct configfs_dirent *committable_group_sd;
| ^~~~~~~~~~~~~~~~~~~~

vim +/committable_group_sd +1714 fs/configfs/dir.c

1707
1708 static int configfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1709 struct inode *new_dir, struct dentry *new_dentry,
1710 unsigned int flags)
1711 {
1712 struct configfs_dirent *sd, *old_parent_sd, *new_parent_sd;
1713 struct dentry *old_parent_dentry, *new_parent_dentry;
> 1714 struct configfs_dirent *committable_group_sd;
1715 struct dentry *committable_group_dentry;
1716 struct config_item *committable_group_item, *item, *new_parent_item;
1717 struct configfs_subsystem *committable_group_subsys;
1718 struct configfs_group_operations *committable_group_ops;
1719 int ret = 0;
1720
1721 if (flags)
1722 return -EINVAL;
1723
1724 old_parent_dentry = old_dentry->d_parent;
1725 new_parent_dentry = new_dentry->d_parent;
1726
1727 sd = old_dentry->d_fsdata;
1728 old_parent_sd = old_dentry->d_parent->d_fsdata;
1729 new_parent_sd = new_dentry->d_parent->d_fsdata;
1730
1731 if (!old_parent_sd || !new_parent_sd)
1732 return -EPERM;
1733
1734 /*
1735 * Renaming must always be between a 'pending' and a 'live' group and
1736 * both need to have the same parent.
1737 */
1738 if (!((old_parent_sd->s_type & CONFIGFS_GROUP_PENDING) &&
1739 (new_parent_sd->s_type & CONFIGFS_GROUP_LIVE)) &&
1740 !((old_parent_sd->s_type & CONFIGFS_GROUP_LIVE) &&
1741 (new_parent_sd->s_type & CONFIGFS_GROUP_PENDING)))
1742 return -EPERM;
1743
1744 if (old_parent_dentry->d_parent != new_parent_dentry->d_parent)
1745 return -EPERM;
1746
1747 committable_group_dentry = old_parent_dentry->d_parent;
1748 committable_group_sd = committable_group_dentry->d_fsdata;
1749 /*
1750 * Grab a reference to the committable group for the duration of
1751 * this function.
1752 */
1753 committable_group_item =
1754 configfs_get_config_item(committable_group_dentry);
1755 committable_group_subsys =
1756 to_config_group(committable_group_item)->cg_subsys;
1757 committable_group_ops = committable_group_item->ci_type->ct_group_ops;
1758
1759 item = sd->s_element;
1760 new_parent_item = new_parent_sd->s_element;
1761
1762 if (WARN_ON(!is_committable_group(committable_group_item))) {
1763 /* This would be a result of a programming error in configfs. */
1764 config_item_put(committable_group_item);
1765 return -EPERM;
1766 }
1767
1768 mutex_lock(&committable_group_subsys->su_mutex);
1769 spin_lock(&configfs_dirent_lock);
1770
1771 if ((old_parent_sd->s_type & CONFIGFS_GROUP_PENDING) &&
1772 (new_parent_sd->s_type & CONFIGFS_GROUP_LIVE))
1773 ret = committable_group_ops->commit_item(item);
1774 else
1775 ret = committable_group_ops->uncommit_item(item);
1776 if (ret)
1777 goto out;
1778
1779 new_dentry->d_fsdata = sd;
1780 list_move(&sd->s_sibling, &new_parent_sd->s_children);
1781 item->ci_parent = new_parent_item;
1782 d_move(old_dentry, new_dentry);
1783
1784 out:
1785 spin_unlock(&configfs_dirent_lock);
1786 mutex_unlock(&committable_group_subsys->su_mutex);
1787 config_item_put(committable_group_item);
1788
1789 return ret;
1790 }
1791

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip