From: kernel test robot <lkp@intel.com>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Mark Tinguely <tinguely@sgi.com>,
Dave Chinner <dchinner@redhat.com>
Subject: [allisonhenderson-xfs_work:delayed_attrs_v22_extended 21/32] fs/xfs/libxfs/xfs_attr.c:659:65: warning: bitwise comparison always evaluates to true
Date: Mon, 26 Jul 2021 16:39:35 +0800 [thread overview]
Message-ID: <202107261628.NkA4LL2E-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6357 bytes --]
tree: https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v22_extended
head: 43a95c4600b7c80ac410a00ac245ccf85b150d26
commit: 40588f91b003a40a0e7ee250219f6405c616a529 [21/32] xfs: add parent pointer support to attribute code
config: nds32-buildonly-randconfig-r001-20210726 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 10.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/allisonhenderson/xfs_work/commit/40588f91b003a40a0e7ee250219f6405c616a529
git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git
git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v22_extended
git checkout 40588f91b003a40a0e7ee250219f6405c616a529
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set':
>> fs/xfs/libxfs/xfs_attr.c:659:65: warning: bitwise comparison always evaluates to true [-Wtautological-compare]
659 | rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
| ^~
vim +659 fs/xfs/libxfs/xfs_attr.c
642
643 /*
644 * Note: If args->value is NULL the attribute will be removed, just like the
645 * Linux ->setattr API.
646 */
647 int
648 xfs_attr_set(
649 struct xfs_da_args *args)
650 {
651 struct xfs_inode *dp = args->dp;
652 struct xfs_mount *mp = dp->i_mount;
653 struct xfs_trans_res tres;
654 bool rsvd;
655 int error, local;
656 int rmt_blks = 0;
657 unsigned int total;
658
> 659 rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
660
661 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
662 return -EIO;
663
664 error = xfs_qm_dqattach(dp);
665 if (error)
666 return error;
667
668 args->geo = mp->m_attr_geo;
669 args->whichfork = XFS_ATTR_FORK;
670 args->hashval = xfs_da_hashname(args->name, args->namelen);
671
672 /*
673 * We have no control over the attribute names that userspace passes us
674 * to remove, so we have to allow the name lookup prior to attribute
675 * removal to fail as well.
676 */
677 args->op_flags = XFS_DA_OP_OKNOENT;
678
679 if (args->value) {
680 XFS_STATS_INC(mp, xs_attr_set);
681
682 args->op_flags |= XFS_DA_OP_ADDNAME;
683 args->total = xfs_attr_calc_size(args, &local);
684
685 /*
686 * If the inode doesn't have an attribute fork, add one.
687 * (inode must not be locked when we call this routine)
688 */
689 if (XFS_IFORK_Q(dp) == 0) {
690 int sf_size = sizeof(struct xfs_attr_sf_hdr) +
691 xfs_attr_sf_entsize_byname(args->namelen,
692 args->valuelen);
693
694 error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
695 if (error)
696 return error;
697 }
698
699 tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
700 M_RES(mp)->tr_attrsetrt.tr_logres *
701 args->total;
702 tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
703 tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
704 total = args->total;
705
706 if (!local)
707 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
708 } else {
709 XFS_STATS_INC(mp, xs_attr_remove);
710
711 tres = M_RES(mp)->tr_attrrm;
712 total = XFS_ATTRRM_SPACE_RES(mp);
713 rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
714 }
715
716 if (xfs_hasdelattr(mp)) {
717 error = xfs_attr_use_log_assist(mp);
718 if (error)
719 return error;
720 }
721
722 /*
723 * Root fork attributes can use reserved data blocks for this
724 * operation if necessary
725 */
726 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
727 if (error)
728 goto drop_incompat;
729
730 if (args->value || xfs_inode_hasattr(dp)) {
731 error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
732 XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
733 if (error)
734 goto out_trans_cancel;
735 }
736
737 if (args->value) {
738 error = xfs_has_attr(args);
739 if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
740 goto out_trans_cancel;
741 if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
742 goto out_trans_cancel;
743 if (error != -ENOATTR && error != -EEXIST)
744 goto out_trans_cancel;
745
746 error = xfs_attr_set_deferred(args);
747 if (error)
748 goto out_trans_cancel;
749
750 /* shortform attribute has already been committed */
751 if (!args->trans)
752 goto out_unlock;
753 } else {
754 error = xfs_has_attr(args);
755 if (error != -EEXIST)
756 goto out_trans_cancel;
757
758 error = xfs_attr_remove_deferred(args);
759 if (error)
760 goto out_trans_cancel;
761 }
762
763 /*
764 * If this is a synchronous mount, make sure that the
765 * transaction goes to disk before returning to the user.
766 */
767 if (mp->m_flags & XFS_MOUNT_WSYNC)
768 xfs_trans_set_sync(args->trans);
769
770 if (!(args->op_flags & XFS_DA_OP_NOTIME))
771 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
772
773 /*
774 * Commit the last in the sequence of transactions.
775 */
776 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
777 error = xfs_trans_commit(args->trans);
778 out_unlock:
779 xfs_iunlock(dp, XFS_ILOCK_EXCL);
780 drop_incompat:
781 if (xfs_hasdelattr(mp))
782 xlog_drop_incompat_feat(mp->m_log);
783 return error;
784
785 out_trans_cancel:
786 if (args->trans)
787 xfs_trans_cancel(args->trans);
788 goto out_unlock;
789 }
790
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33928 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [allisonhenderson-xfs_work:delayed_attrs_v22_extended 21/32] fs/xfs/libxfs/xfs_attr.c:659:65: warning: bitwise comparison always evaluates to true
Date: Mon, 26 Jul 2021 16:39:35 +0800 [thread overview]
Message-ID: <202107261628.NkA4LL2E-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6540 bytes --]
tree: https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v22_extended
head: 43a95c4600b7c80ac410a00ac245ccf85b150d26
commit: 40588f91b003a40a0e7ee250219f6405c616a529 [21/32] xfs: add parent pointer support to attribute code
config: nds32-buildonly-randconfig-r001-20210726 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 10.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/allisonhenderson/xfs_work/commit/40588f91b003a40a0e7ee250219f6405c616a529
git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git
git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v22_extended
git checkout 40588f91b003a40a0e7ee250219f6405c616a529
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set':
>> fs/xfs/libxfs/xfs_attr.c:659:65: warning: bitwise comparison always evaluates to true [-Wtautological-compare]
659 | rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
| ^~
vim +659 fs/xfs/libxfs/xfs_attr.c
642
643 /*
644 * Note: If args->value is NULL the attribute will be removed, just like the
645 * Linux ->setattr API.
646 */
647 int
648 xfs_attr_set(
649 struct xfs_da_args *args)
650 {
651 struct xfs_inode *dp = args->dp;
652 struct xfs_mount *mp = dp->i_mount;
653 struct xfs_trans_res tres;
654 bool rsvd;
655 int error, local;
656 int rmt_blks = 0;
657 unsigned int total;
658
> 659 rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
660
661 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
662 return -EIO;
663
664 error = xfs_qm_dqattach(dp);
665 if (error)
666 return error;
667
668 args->geo = mp->m_attr_geo;
669 args->whichfork = XFS_ATTR_FORK;
670 args->hashval = xfs_da_hashname(args->name, args->namelen);
671
672 /*
673 * We have no control over the attribute names that userspace passes us
674 * to remove, so we have to allow the name lookup prior to attribute
675 * removal to fail as well.
676 */
677 args->op_flags = XFS_DA_OP_OKNOENT;
678
679 if (args->value) {
680 XFS_STATS_INC(mp, xs_attr_set);
681
682 args->op_flags |= XFS_DA_OP_ADDNAME;
683 args->total = xfs_attr_calc_size(args, &local);
684
685 /*
686 * If the inode doesn't have an attribute fork, add one.
687 * (inode must not be locked when we call this routine)
688 */
689 if (XFS_IFORK_Q(dp) == 0) {
690 int sf_size = sizeof(struct xfs_attr_sf_hdr) +
691 xfs_attr_sf_entsize_byname(args->namelen,
692 args->valuelen);
693
694 error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
695 if (error)
696 return error;
697 }
698
699 tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
700 M_RES(mp)->tr_attrsetrt.tr_logres *
701 args->total;
702 tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
703 tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
704 total = args->total;
705
706 if (!local)
707 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
708 } else {
709 XFS_STATS_INC(mp, xs_attr_remove);
710
711 tres = M_RES(mp)->tr_attrrm;
712 total = XFS_ATTRRM_SPACE_RES(mp);
713 rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
714 }
715
716 if (xfs_hasdelattr(mp)) {
717 error = xfs_attr_use_log_assist(mp);
718 if (error)
719 return error;
720 }
721
722 /*
723 * Root fork attributes can use reserved data blocks for this
724 * operation if necessary
725 */
726 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
727 if (error)
728 goto drop_incompat;
729
730 if (args->value || xfs_inode_hasattr(dp)) {
731 error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
732 XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
733 if (error)
734 goto out_trans_cancel;
735 }
736
737 if (args->value) {
738 error = xfs_has_attr(args);
739 if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
740 goto out_trans_cancel;
741 if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
742 goto out_trans_cancel;
743 if (error != -ENOATTR && error != -EEXIST)
744 goto out_trans_cancel;
745
746 error = xfs_attr_set_deferred(args);
747 if (error)
748 goto out_trans_cancel;
749
750 /* shortform attribute has already been committed */
751 if (!args->trans)
752 goto out_unlock;
753 } else {
754 error = xfs_has_attr(args);
755 if (error != -EEXIST)
756 goto out_trans_cancel;
757
758 error = xfs_attr_remove_deferred(args);
759 if (error)
760 goto out_trans_cancel;
761 }
762
763 /*
764 * If this is a synchronous mount, make sure that the
765 * transaction goes to disk before returning to the user.
766 */
767 if (mp->m_flags & XFS_MOUNT_WSYNC)
768 xfs_trans_set_sync(args->trans);
769
770 if (!(args->op_flags & XFS_DA_OP_NOTIME))
771 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
772
773 /*
774 * Commit the last in the sequence of transactions.
775 */
776 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
777 error = xfs_trans_commit(args->trans);
778 out_unlock:
779 xfs_iunlock(dp, XFS_ILOCK_EXCL);
780 drop_incompat:
781 if (xfs_hasdelattr(mp))
782 xlog_drop_incompat_feat(mp->m_log);
783 return error;
784
785 out_trans_cancel:
786 if (args->trans)
787 xfs_trans_cancel(args->trans);
788 goto out_unlock;
789 }
790
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33928 bytes --]
next reply other threads:[~2021-07-26 8:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 8:39 kernel test robot [this message]
2021-07-26 8:39 ` [allisonhenderson-xfs_work:delayed_attrs_v22_extended 21/32] fs/xfs/libxfs/xfs_attr.c:659:65: warning: bitwise comparison always evaluates to true kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202107261628.NkA4LL2E-lkp@intel.com \
--to=lkp@intel.com \
--cc=allison.henderson@oracle.com \
--cc=dchinner@redhat.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tinguely@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.