All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [allisonhenderson-xfs_work:delayed_attrs_v21_extended 51/62] fs/xfs/libxfs/xfs_attr.c:657:65: warning: bitwise comparison always evaluates to true
Date: Mon, 19 Jul 2021 11:55:14 +0800	[thread overview]
Message-ID: <202107191103.ZYSfUwi2-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6257 bytes --]

tree:   https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v21_extended
head:   1a71ced599b41e7ee9f0ea02427b76c30f71f7dd
commit: 41581bf165b262422a2d4b58c25f5d757603b84a [51/62] xfs: add parent pointer support to attribute code
config: s390-allyesconfig (attached as .config)
compiler: s390-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/41581bf165b262422a2d4b58c25f5d757603b84a
        git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git
        git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v21_extended
        git checkout 41581bf165b262422a2d4b58c25f5d757603b84a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=s390 

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:657:65: warning: bitwise comparison always evaluates to true [-Wtautological-compare]
     657 |  rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
         |                                                                 ^~


vim +657 fs/xfs/libxfs/xfs_attr.c

   640	
   641	/*
   642	 * Note: If args->value is NULL the attribute will be removed, just like the
   643	 * Linux ->setattr API.
   644	 */
   645	int
   646	xfs_attr_set(
   647		struct xfs_da_args	*args)
   648	{
   649		struct xfs_inode	*dp = args->dp;
   650		struct xfs_mount	*mp = dp->i_mount;
   651		struct xfs_trans_res	tres;
   652		bool			rsvd;
   653		int			error, local;
   654		int			rmt_blks = 0;
   655		unsigned int		total;
   656	
 > 657		rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
   658	
   659		if (XFS_FORCED_SHUTDOWN(dp->i_mount))
   660			return -EIO;
   661	
   662		error = xfs_qm_dqattach(dp);
   663		if (error)
   664			return error;
   665	
   666		args->geo = mp->m_attr_geo;
   667		args->whichfork = XFS_ATTR_FORK;
   668		args->hashval = xfs_da_hashname(args->name, args->namelen);
   669	
   670		/*
   671		 * We have no control over the attribute names that userspace passes us
   672		 * to remove, so we have to allow the name lookup prior to attribute
   673		 * removal to fail as well.
   674		 */
   675		args->op_flags = XFS_DA_OP_OKNOENT;
   676	
   677		if (args->value) {
   678			XFS_STATS_INC(mp, xs_attr_set);
   679	
   680			args->op_flags |= XFS_DA_OP_ADDNAME;
   681			args->total = xfs_attr_calc_size(args, &local);
   682	
   683			/*
   684			 * If the inode doesn't have an attribute fork, add one.
   685			 * (inode must not be locked when we call this routine)
   686			 */
   687			if (XFS_IFORK_Q(dp) == 0) {
   688				int sf_size = sizeof(struct xfs_attr_sf_hdr) +
   689					xfs_attr_sf_entsize_byname(args->namelen,
   690							args->valuelen);
   691	
   692				error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
   693				if (error)
   694					return error;
   695			}
   696	
   697			tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
   698					 M_RES(mp)->tr_attrsetrt.tr_logres *
   699						args->total;
   700			tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
   701			tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
   702			total = args->total;
   703	
   704			if (!local)
   705				rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
   706		} else {
   707			XFS_STATS_INC(mp, xs_attr_remove);
   708	
   709			tres = M_RES(mp)->tr_attrrm;
   710			total = XFS_ATTRRM_SPACE_RES(mp);
   711			rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
   712		}
   713	
   714		/*
   715		 * Root fork attributes can use reserved data blocks for this
   716		 * operation if necessary
   717		 */
   718		error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
   719		if (error)
   720			return error;
   721	
   722		if (args->value || xfs_inode_hasattr(dp)) {
   723			error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
   724					XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
   725			if (error)
   726				goto out_trans_cancel;
   727		}
   728	
   729		if (args->value) {
   730			error = xfs_has_attr(args);
   731			if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
   732				goto out_trans_cancel;
   733			if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
   734				goto out_trans_cancel;
   735			if (error != -ENOATTR && error != -EEXIST)
   736				goto out_trans_cancel;
   737	
   738			error = xfs_attr_set_deferred(args);
   739			if (error)
   740				goto out_trans_cancel;
   741	
   742			/* shortform attribute has already been committed */
   743			if (!args->trans)
   744				goto out_unlock;
   745		} else {
   746			error = xfs_has_attr(args);
   747			if (error != -EEXIST)
   748				goto out_trans_cancel;
   749	
   750			error = xfs_attr_remove_deferred(args);
   751			if (error)
   752				goto out_trans_cancel;
   753		}
   754	
   755		/*
   756		 * If this is a synchronous mount, make sure that the
   757		 * transaction goes to disk before returning to the user.
   758		 */
   759		if (mp->m_flags & XFS_MOUNT_WSYNC)
   760			xfs_trans_set_sync(args->trans);
   761	
   762		if (!(args->op_flags & XFS_DA_OP_NOTIME))
   763			xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
   764	
   765		/*
   766		 * Commit the last in the sequence of transactions.
   767		 */
   768		xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
   769		error = xfs_trans_commit(args->trans);
   770	out_unlock:
   771		xfs_iunlock(dp, XFS_ILOCK_EXCL);
   772		return error;
   773	
   774	out_trans_cancel:
   775		if (args->trans)
   776			xfs_trans_cancel(args->trans);
   777		goto out_unlock;
   778	}
   779	

---
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: 66573 bytes --]

WARNING: multiple messages have this Message-ID (diff)
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_v21_extended 51/62] fs/xfs/libxfs/xfs_attr.c:657:65: warning: bitwise comparison always evaluates to true
Date: Mon, 19 Jul 2021 11:55:14 +0800	[thread overview]
Message-ID: <202107191103.ZYSfUwi2-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6083 bytes --]

tree:   https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v21_extended
head:   1a71ced599b41e7ee9f0ea02427b76c30f71f7dd
commit: 41581bf165b262422a2d4b58c25f5d757603b84a [51/62] xfs: add parent pointer support to attribute code
config: s390-allyesconfig (attached as .config)
compiler: s390-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/41581bf165b262422a2d4b58c25f5d757603b84a
        git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git
        git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v21_extended
        git checkout 41581bf165b262422a2d4b58c25f5d757603b84a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=s390 

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:657:65: warning: bitwise comparison always evaluates to true [-Wtautological-compare]
     657 |  rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
         |                                                                 ^~


vim +657 fs/xfs/libxfs/xfs_attr.c

   640	
   641	/*
   642	 * Note: If args->value is NULL the attribute will be removed, just like the
   643	 * Linux ->setattr API.
   644	 */
   645	int
   646	xfs_attr_set(
   647		struct xfs_da_args	*args)
   648	{
   649		struct xfs_inode	*dp = args->dp;
   650		struct xfs_mount	*mp = dp->i_mount;
   651		struct xfs_trans_res	tres;
   652		bool			rsvd;
   653		int			error, local;
   654		int			rmt_blks = 0;
   655		unsigned int		total;
   656	
 > 657		rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
   658	
   659		if (XFS_FORCED_SHUTDOWN(dp->i_mount))
   660			return -EIO;
   661	
   662		error = xfs_qm_dqattach(dp);
   663		if (error)
   664			return error;
   665	
   666		args->geo = mp->m_attr_geo;
   667		args->whichfork = XFS_ATTR_FORK;
   668		args->hashval = xfs_da_hashname(args->name, args->namelen);
   669	
   670		/*
   671		 * We have no control over the attribute names that userspace passes us
   672		 * to remove, so we have to allow the name lookup prior to attribute
   673		 * removal to fail as well.
   674		 */
   675		args->op_flags = XFS_DA_OP_OKNOENT;
   676	
   677		if (args->value) {
   678			XFS_STATS_INC(mp, xs_attr_set);
   679	
   680			args->op_flags |= XFS_DA_OP_ADDNAME;
   681			args->total = xfs_attr_calc_size(args, &local);
   682	
   683			/*
   684			 * If the inode doesn't have an attribute fork, add one.
   685			 * (inode must not be locked when we call this routine)
   686			 */
   687			if (XFS_IFORK_Q(dp) == 0) {
   688				int sf_size = sizeof(struct xfs_attr_sf_hdr) +
   689					xfs_attr_sf_entsize_byname(args->namelen,
   690							args->valuelen);
   691	
   692				error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
   693				if (error)
   694					return error;
   695			}
   696	
   697			tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
   698					 M_RES(mp)->tr_attrsetrt.tr_logres *
   699						args->total;
   700			tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
   701			tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
   702			total = args->total;
   703	
   704			if (!local)
   705				rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
   706		} else {
   707			XFS_STATS_INC(mp, xs_attr_remove);
   708	
   709			tres = M_RES(mp)->tr_attrrm;
   710			total = XFS_ATTRRM_SPACE_RES(mp);
   711			rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
   712		}
   713	
   714		/*
   715		 * Root fork attributes can use reserved data blocks for this
   716		 * operation if necessary
   717		 */
   718		error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
   719		if (error)
   720			return error;
   721	
   722		if (args->value || xfs_inode_hasattr(dp)) {
   723			error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
   724					XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
   725			if (error)
   726				goto out_trans_cancel;
   727		}
   728	
   729		if (args->value) {
   730			error = xfs_has_attr(args);
   731			if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
   732				goto out_trans_cancel;
   733			if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
   734				goto out_trans_cancel;
   735			if (error != -ENOATTR && error != -EEXIST)
   736				goto out_trans_cancel;
   737	
   738			error = xfs_attr_set_deferred(args);
   739			if (error)
   740				goto out_trans_cancel;
   741	
   742			/* shortform attribute has already been committed */
   743			if (!args->trans)
   744				goto out_unlock;
   745		} else {
   746			error = xfs_has_attr(args);
   747			if (error != -EEXIST)
   748				goto out_trans_cancel;
   749	
   750			error = xfs_attr_remove_deferred(args);
   751			if (error)
   752				goto out_trans_cancel;
   753		}
   754	
   755		/*
   756		 * If this is a synchronous mount, make sure that the
   757		 * transaction goes to disk before returning to the user.
   758		 */
   759		if (mp->m_flags & XFS_MOUNT_WSYNC)
   760			xfs_trans_set_sync(args->trans);
   761	
   762		if (!(args->op_flags & XFS_DA_OP_NOTIME))
   763			xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
   764	
   765		/*
   766		 * Commit the last in the sequence of transactions.
   767		 */
   768		xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
   769		error = xfs_trans_commit(args->trans);
   770	out_unlock:
   771		xfs_iunlock(dp, XFS_ILOCK_EXCL);
   772		return error;
   773	
   774	out_trans_cancel:
   775		if (args->trans)
   776			xfs_trans_cancel(args->trans);
   777		goto out_unlock;
   778	}
   779	

---
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: 66573 bytes --]

             reply	other threads:[~2021-07-19  3:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  3:55 kernel test robot [this message]
2021-07-19  3:55 ` [allisonhenderson-xfs_work:delayed_attrs_v21_extended 51/62] fs/xfs/libxfs/xfs_attr.c:657: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=202107191103.ZYSfUwi2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /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.