* [PATCH] xfs: check for null dquot in xfs_quota_calc_throttle()
@ 2014-10-01 16:16 Eric Sandeen
2014-10-01 23:25 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2014-10-01 16:16 UTC (permalink / raw)
To: xfs-oss
Coverity spotted this.
Granted, we *just* checked xfs_inod_dquot() in the caller (by calling
xfs_quota_need_throttle), but to be honest I don't know if this can
race, and this is the only place we don't check the return value -
and the check seems cheap and future-proof.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Sorry for the handwavy commit log, if it's obvious that it can
race, feel free to fix the description. ;)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index e9c47b6..afcf3c9 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -404,8 +404,8 @@ xfs_quota_calc_throttle(
int shift = 0;
struct xfs_dquot *dq = xfs_inode_dquot(ip, type);
- /* over hi wmark, squash the prealloc completely */
- if (dq->q_res_bcount >= dq->q_prealloc_hi_wmark) {
+ /* no dq, or over hi wmark, squash the prealloc completely */
+ if (!dq || dq->q_res_bcount >= dq->q_prealloc_hi_wmark) {
*qblocks = 0;
*qfreesp = 0;
return;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] xfs: check for null dquot in xfs_quota_calc_throttle()
2014-10-01 16:16 [PATCH] xfs: check for null dquot in xfs_quota_calc_throttle() Eric Sandeen
@ 2014-10-01 23:25 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2014-10-01 23:25 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Wed, Oct 01, 2014 at 11:16:37AM -0500, Eric Sandeen wrote:
> Coverity spotted this.
>
> Granted, we *just* checked xfs_inod_dquot() in the caller (by calling
> xfs_quota_need_throttle), but to be honest I don't know if this can
> race, and this is the only place we don't check the return value -
> and the check seems cheap and future-proof.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Sorry for the handwavy commit log, if it's obvious that it can
> race, feel free to fix the description. ;)
Description changed simply to say:
... this is the only place we don't check the return value, but the
check is cheap and future-proof, so add it.
And so:
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-01 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 16:16 [PATCH] xfs: check for null dquot in xfs_quota_calc_throttle() Eric Sandeen
2014-10-01 23:25 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox