Message ID | 1585794394-31041-1-git-send-email-kaixuxia@tencent.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs: combine two if statements with same condition | expand |
On 4/1/20 7:26 PM, xiakaixu1987@gmail.com wrote: > From: Kaixu Xia <kaixuxia@tencent.com> > > The two if statements have same condition, and the mask value > does not change in xfs_setattr_nonsize(), so combine them. > > Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Prior to the commit c4ed4243c40f ("xfs: split xfs_setattr") xfs_setattr() had truncate handling in between two identical changing file ownership ifs. Since then truncate code is moved out of xfs_setattr() and mask value stays the same in the first if, it make sense to combine these two ifs. Looks good to me. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On Thu, Apr 02, 2020 at 10:26:34AM +0800, xiakaixu1987@gmail.com wrote: > From: Kaixu Xia <kaixuxia@tencent.com> > > The two if statements have same condition, and the mask value > does not change in xfs_setattr_nonsize(), so combine them. > > Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index f7a99b3..e348145 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -738,12 +738,7 @@ if (error) /* out of quota */ goto out_cancel; } - } - /* - * Change file ownership. Must be the owner or privileged. - */ - if (mask & (ATTR_UID|ATTR_GID)) { /* * CAP_FSETID overrides the following restrictions: *