public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] small quota updates for 2.6.34
@ 2010-01-13 22:05 Christoph Hellwig
  2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-13 22:05 UTC (permalink / raw)
  To: xfs


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC
  2010-01-13 22:05 [PATCH 0/3] small quota updates for 2.6.34 Christoph Hellwig
@ 2010-01-13 22:05 ` Christoph Hellwig
  2010-01-14  0:47   ` Dave Chinner
  2010-01-14 18:59   ` Alex Elder
  2010-01-13 22:05 ` [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv Christoph Hellwig
  2010-01-13 22:05 ` [PATCH 3/3] xfs: implement quota warnings via netlink Christoph Hellwig
  2 siblings, 2 replies; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-13 22:05 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-XFS_QMOPT_ASYNC --]
[-- Type: text/plain, Size: 1207 bytes --]

The option is unused and one of the few remaining users of xfs_bawrite,
so let's get rid of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/quota/xfs_dquot.c
===================================================================
--- linux-2.6.orig/fs/xfs/quota/xfs_dquot.c	2010-01-08 15:10:07.694006652 +0100
+++ linux-2.6/fs/xfs/quota/xfs_dquot.c	2010-01-08 15:10:26.227006460 +0100
@@ -1253,8 +1253,6 @@ xfs_qm_dqflush(
 
 	if (flags & XFS_QMOPT_DELWRI) {
 		xfs_bdwrite(mp, bp);
-	} else if (flags & XFS_QMOPT_ASYNC) {
-		error = xfs_bawrite(mp, bp);
 	} else {
 		error = xfs_bwrite(mp, bp);
 	}
Index: linux-2.6/fs/xfs/xfs_quota.h
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_quota.h	2010-01-08 15:10:07.729006360 +0100
+++ linux-2.6/fs/xfs/xfs_quota.h	2010-01-08 15:10:12.062005658 +0100
@@ -226,7 +226,6 @@ typedef struct xfs_qoff_logformat {
  * flags for dqflush and dqflush_all.
  */
 #define XFS_QMOPT_SYNC		0x1000000
-#define XFS_QMOPT_ASYNC		0x2000000
 #define XFS_QMOPT_DELWRI	0x4000000
 
 /*

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv
  2010-01-13 22:05 [PATCH 0/3] small quota updates for 2.6.34 Christoph Hellwig
  2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
@ 2010-01-13 22:05 ` Christoph Hellwig
  2010-01-14  0:53   ` Dave Chinner
  2010-01-13 22:05 ` [PATCH 3/3] xfs: implement quota warnings via netlink Christoph Hellwig
  2 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-13 22:05 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-cleanup-xfs_trans_dqresv --]
[-- Type: text/plain, Size: 2998 bytes --]

Move the error code selection after the goto label and fold the
xfs_quota_error helper into it.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 13:37:38.652253919 +0100
+++ xfs/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 13:50:50.132006544 +0100
@@ -589,14 +589,6 @@ xfs_trans_unreserve_and_mod_dquots(
 	}
 }
 
-STATIC int
-xfs_quota_error(uint flags)
-{
-	if (flags & XFS_QMOPT_ENOSPC)
-		return ENOSPC;
-	return EDQUOT;
-}
-
 /*
  * This reserves disk blocks and inodes against a dquot.
  * Flags indicate if the dquot is to be locked here and also
@@ -612,7 +604,6 @@ xfs_trans_dqresv(
 	long		ninos,
 	uint		flags)
 {
-	int		error;
 	xfs_qcnt_t	hardlimit;
 	xfs_qcnt_t	softlimit;
 	time_t		timer;
@@ -649,7 +640,6 @@ xfs_trans_dqresv(
 		warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
 		resbcountp = &dqp->q_res_rtbcount;
 	}
-	error = 0;
 
 	if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
 	    dqp->q_core.d_id &&
@@ -667,19 +657,13 @@ xfs_trans_dqresv(
 			 * nblks.
 			 */
 			if (hardlimit > 0ULL &&
-			     (hardlimit <= nblks + *resbcountp)) {
-				error = xfs_quota_error(flags);
+			    hardlimit <= nblks + *resbcountp)
 				goto error_return;
-			}
-
 			if (softlimit > 0ULL &&
-			     (softlimit <= nblks + *resbcountp)) {
-				if ((timer != 0 && get_seconds() > timer) ||
-				    (warns != 0 && warns >= warnlimit)) {
-					error = xfs_quota_error(flags);
-					goto error_return;
-				}
-			}
+			    softlimit <= nblks + *resbcountp &&
+			    ((timer != 0 && get_seconds() > timer) ||
+			     (warns != 0 && warns >= warnlimit)))
+				goto error_return;
 		}
 		if (ninos > 0) {
 			count = be64_to_cpu(dqp->q_core.d_icount);
@@ -692,16 +676,13 @@ xfs_trans_dqresv(
 			softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
 			if (!softlimit)
 				softlimit = q->qi_isoftlimit;
-			if (hardlimit > 0ULL && count >= hardlimit) {
-				error = xfs_quota_error(flags);
+
+			if (hardlimit > 0ULL && count >= hardlimit)
+				goto error_return;
+			if (softlimit > 0ULL && count >= softlimit &&
+			    ((timer != 0 && get_seconds() > timer) ||
+			     (warns != 0 && warns >= warnlimit)))
 				goto error_return;
-			} else if (softlimit > 0ULL && count >= softlimit) {
-				if ((timer != 0 && get_seconds() > timer) ||
-				     (warns != 0 && warns >= warnlimit)) {
-					error = xfs_quota_error(flags);
-					goto error_return;
-				}
-			}
 		}
 	}
 
@@ -736,9 +717,14 @@ xfs_trans_dqresv(
 	ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
 	ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
 
+	xfs_dqunlock(dqp);
+	return 0;
+
 error_return:
 	xfs_dqunlock(dqp);
-	return error;
+	if (flags & XFS_QMOPT_ENOSPC)
+		return ENOSPC;
+	return EDQUOT;
 }
 
 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3] xfs: implement quota warnings via netlink
  2010-01-13 22:05 [PATCH 0/3] small quota updates for 2.6.34 Christoph Hellwig
  2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
  2010-01-13 22:05 ` [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv Christoph Hellwig
@ 2010-01-13 22:05 ` Christoph Hellwig
  2010-01-14  1:19   ` Dave Chinner
  2010-01-17 22:36   ` [PATCH 3/3 v2] " Christoph Hellwig
  2 siblings, 2 replies; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-13 22:05 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-quotanl-warn --]
[-- Type: text/plain, Size: 2423 bytes --]

Wire up quota_send_warning to send quota warnings over netlink.  This is
used by various desktops to show user quota warnings.

Tested by running the quota_nld daemon while running the xfstest quota
tests and observing the warnings.  I'll see how I can get a more formal
testcase for it written.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 13:51:20.925003101 +0100
+++ xfs/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 14:10:46.083254517 +0100
@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots(
 	}
 }
 
+STATIC void
+xfs_quota_send_warning(
+	struct xfs_mount	*mp,
+	struct xfs_dquot	*dqp,
+	int			hard)
+{
+	/* no warnings for project quotas - we just return ENOSPC later */
+	if (dqp->dq_flags & XFS_DQ_PROJ)
+		return;
+	quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
+			   be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
+			   hard ? QUOTA_NL_BHARDWARN: QUOTA_NL_BSOFTWARN);
+}
+
 /*
  * This reserves disk blocks and inodes against a dquot.
  * Flags indicate if the dquot is to be locked here and also
@@ -612,6 +626,7 @@ xfs_trans_dqresv(
 	xfs_qcnt_t	count;
 	xfs_qcnt_t	*resbcountp;
 	xfs_quotainfo_t	*q = mp->m_quotainfo;
+	int		hardwarn = 0;
 
 
 	xfs_dqlock(dqp);
@@ -657,8 +672,10 @@ xfs_trans_dqresv(
 			 * nblks.
 			 */
 			if (hardlimit > 0ULL &&
-			    hardlimit <= nblks + *resbcountp)
+			    hardlimit <= nblks + *resbcountp) {
+				hardwarn = 1;
 				goto error_return;
+			}
 			if (softlimit > 0ULL &&
 			    softlimit <= nblks + *resbcountp &&
 			    ((timer != 0 && get_seconds() > timer) ||
@@ -677,8 +694,10 @@ xfs_trans_dqresv(
 			if (!softlimit)
 				softlimit = q->qi_isoftlimit;
 
-			if (hardlimit > 0ULL && count >= hardlimit)
+			if (hardlimit > 0ULL && count >= hardlimit) {
+				hardwarn = 1;
 				goto error_return;
+			}
 			if (softlimit > 0ULL && count >= softlimit &&
 			    ((timer != 0 && get_seconds() > timer) ||
 			     (warns != 0 && warns >= warnlimit)))
@@ -722,6 +741,7 @@ xfs_trans_dqresv(
 
 error_return:
 	xfs_dqunlock(dqp);
+	xfs_quota_send_warning(mp, dqp, hardwarn);
 	if (flags & XFS_QMOPT_ENOSPC)
 		return ENOSPC;
 	return EDQUOT;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC
  2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
@ 2010-01-14  0:47   ` Dave Chinner
  2010-01-14 18:59   ` Alex Elder
  1 sibling, 0 replies; 11+ messages in thread
From: Dave Chinner @ 2010-01-14  0:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Jan 13, 2010 at 05:05:48PM -0500, Christoph Hellwig wrote:
> The option is unused and one of the few remaining users of xfs_bawrite,
> so let's get rid of it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Dave Chinner <david@fromorbit.com>

FWIW, I've got a bigger patch that kills off all three
QMOPT writeback flags, but it isn't quite ready yet...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv
  2010-01-13 22:05 ` [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv Christoph Hellwig
@ 2010-01-14  0:53   ` Dave Chinner
  0 siblings, 0 replies; 11+ messages in thread
From: Dave Chinner @ 2010-01-14  0:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Jan 13, 2010 at 05:05:49PM -0500, Christoph Hellwig wrote:
> Move the error code selection after the goto label and fold the
> xfs_quota_error helper into it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Dave Chinner <david@fromorbit.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] 11+ messages in thread

* Re: [PATCH 3/3] xfs: implement quota warnings via netlink
  2010-01-13 22:05 ` [PATCH 3/3] xfs: implement quota warnings via netlink Christoph Hellwig
@ 2010-01-14  1:19   ` Dave Chinner
  2010-01-14  6:42     ` Christoph Hellwig
  2010-01-17 22:36   ` [PATCH 3/3 v2] " Christoph Hellwig
  1 sibling, 1 reply; 11+ messages in thread
From: Dave Chinner @ 2010-01-14  1:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Jan 13, 2010 at 05:05:50PM -0500, Christoph Hellwig wrote:
> Wire up quota_send_warning to send quota warnings over netlink.  This is
> used by various desktops to show user quota warnings.

A couple of comments below.

> Tested by running the quota_nld daemon while running the xfstest quota
> tests and observing the warnings.  I'll see how I can get a more formal
> testcase for it written.

Sounds like it needs something similar to the dmapi event listeners
we use for testing that the dmapi events are generated correctly....

> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 13:51:20.925003101 +0100
> +++ xfs/fs/xfs/quota/xfs_trans_dquot.c	2010-01-13 14:10:46.083254517 +0100
> @@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots(
>  	}
>  }
>  
> +STATIC void
> +xfs_quota_send_warning(
> +	struct xfs_mount	*mp,
> +	struct xfs_dquot	*dqp,
> +	int			hard)
> +{
> +	/* no warnings for project quotas - we just return ENOSPC later */
> +	if (dqp->dq_flags & XFS_DQ_PROJ)
> +		return;
> +	quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
> +			   be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
> +			   hard ? QUOTA_NL_BHARDWARN: QUOTA_NL_BSOFTWARN);
> +}

This appears to send "over block quota" warnings even when
the error is caused by the number of inodes going over limit.
For inode count warnings we should be sending QUOTA_NL_IHARDWARN or
QUOTA_NL_ISOFTWARN. That could be easily done if the "hard"
parameter is changed to the type of warning which is set up
in the calling function.

We could probably even return the grace limit expired versions
as well when over the soft limits with a slight change to the
soft limit warning logic as well...


> +
>  /*
>   * This reserves disk blocks and inodes against a dquot.
>   * Flags indicate if the dquot is to be locked here and also
> @@ -612,6 +626,7 @@ xfs_trans_dqresv(
>  	xfs_qcnt_t	count;
>  	xfs_qcnt_t	*resbcountp;
>  	xfs_quotainfo_t	*q = mp->m_quotainfo;
> +	int		hardwarn = 0;

As mentioned above, this should probably be a "warn_type"
parameter rather than a boolean hard/soft warning flag.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] xfs: implement quota warnings via netlink
  2010-01-14  1:19   ` Dave Chinner
@ 2010-01-14  6:42     ` Christoph Hellwig
  0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-14  6:42 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, xfs

On Thu, Jan 14, 2010 at 12:19:48PM +1100, Dave Chinner wrote:
> > Tested by running the quota_nld daemon while running the xfstest quota
> > tests and observing the warnings.  I'll see how I can get a more formal
> > testcase for it written.
> 
> Sounds like it needs something similar to the dmapi event listeners
> we use for testing that the dmapi events are generated correctly....

That's what quota_nld does, just need to tie it up properly.

> This appears to send "over block quota" warnings even when
> the error is caused by the number of inodes going over limit.
> For inode count warnings we should be sending QUOTA_NL_IHARDWARN or
> QUOTA_NL_ISOFTWARN. That could be easily done if the "hard"
> parameter is changed to the type of warning which is set up
> in the calling function.
> 
> We could probably even return the grace limit expired versions
> as well when over the soft limits with a slight change to the
> soft limit warning logic as well...

Indeed, I did copy this from gfs2 which only does the block quotas
and no differciated soft warnings.  I'll respin it.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC
  2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
  2010-01-14  0:47   ` Dave Chinner
@ 2010-01-14 18:59   ` Alex Elder
  1 sibling, 0 replies; 11+ messages in thread
From: Alex Elder @ 2010-01-14 18:59 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Christoph Hellwig wrote:
> The option is unused and one of the few remaining users of xfs_bawrite,
> so let's get rid of it.

Looks good.

> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Alex Elder <aelder@sgi.com>


> Index: linux-2.6/fs/xfs/quota/xfs_dquot.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/quota/xfs_dquot.c	2010-01-08 15:10:07.694006652 +0100
> +++ linux-2.6/fs/xfs/quota/xfs_dquot.c	2010-01-08 15:10:26.227006460 +0100
> @@ -1253,8 +1253,6 @@ xfs_qm_dqflush(
> 
>  	if (flags & XFS_QMOPT_DELWRI) {
>  		xfs_bdwrite(mp, bp);
> -	} else if (flags & XFS_QMOPT_ASYNC) {
> -		error = xfs_bawrite(mp, bp);
>  	} else {
>  		error = xfs_bwrite(mp, bp);
>  	}
> Index: linux-2.6/fs/xfs/xfs_quota.h
> ===================================================================
> --- linux-2.6.orig/fs/xfs/xfs_quota.h	2010-01-08 15:10:07.729006360 +0100
> +++ linux-2.6/fs/xfs/xfs_quota.h	2010-01-08 15:10:12.062005658 +0100
> @@ -226,7 +226,6 @@ typedef struct xfs_qoff_logformat {
>   * flags for dqflush and dqflush_all.
>   */
>  #define XFS_QMOPT_SYNC		0x1000000
> -#define XFS_QMOPT_ASYNC		0x2000000
>  #define XFS_QMOPT_DELWRI	0x4000000
> 
>  /*
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3 v2] xfs: implement quota warnings via netlink
  2010-01-13 22:05 ` [PATCH 3/3] xfs: implement quota warnings via netlink Christoph Hellwig
  2010-01-14  1:19   ` Dave Chinner
@ 2010-01-17 22:36   ` Christoph Hellwig
  2010-01-18 11:03     ` Dave Chinner
  1 sibling, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2010-01-17 22:36 UTC (permalink / raw)
  To: xfs

Wire up quota_send_warning to send quota warnings over netlink.  This is
used by various desktops to show user quota warnings.

Tested by running the quota_nld daemon while running the xfstest quota
tests and observing the warnings.  I'll see how I can get a more formal
testcase for it written.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c	2010-01-17 11:02:29.340004208 +0100
+++ xfs/fs/xfs/quota/xfs_trans_dquot.c	2010-01-17 13:41:34.142005475 +0100
@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots(
 	}
 }
 
+STATIC void
+xfs_quota_warn(
+	struct xfs_mount	*mp,
+	struct xfs_dquot	*dqp,
+	int			type)
+{
+	/* no warnings for project quotas - we just return ENOSPC later */
+	if (dqp->dq_flags & XFS_DQ_PROJ)
+		return;
+	quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
+			   be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
+			   type);
+}
+
 /*
  * This reserves disk blocks and inodes against a dquot.
  * Flags indicate if the dquot is to be locked here and also
@@ -657,13 +671,21 @@ xfs_trans_dqresv(
 			 * nblks.
 			 */
 			if (hardlimit > 0ULL &&
-			    hardlimit <= nblks + *resbcountp)
+			    hardlimit <= nblks + *resbcountp) {
+				xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
 				goto error_return;
+			}
 			if (softlimit > 0ULL &&
-			    softlimit <= nblks + *resbcountp &&
-			    ((timer != 0 && get_seconds() > timer) ||
-			     (warns != 0 && warns >= warnlimit)))
-				goto error_return;
+			    softlimit <= nblks + *resbcountp) {
+				if ((timer != 0 && get_seconds() > timer) ||
+				    (warns != 0 && warns >= warnlimit)) {
+					xfs_quota_warn(mp, dqp,
+						       QUOTA_NL_BSOFTLONGWARN);
+					goto error_return;
+				}
+
+				xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
+			}
 		}
 		if (ninos > 0) {
 			count = be64_to_cpu(dqp->q_core.d_icount);
@@ -677,12 +699,19 @@ xfs_trans_dqresv(
 			if (!softlimit)
 				softlimit = q->qi_isoftlimit;
 
-			if (hardlimit > 0ULL && count >= hardlimit)
-				goto error_return;
-			if (softlimit > 0ULL && count >= softlimit &&
-			    ((timer != 0 && get_seconds() > timer) ||
-			     (warns != 0 && warns >= warnlimit)))
+			if (hardlimit > 0ULL && count >= hardlimit) {
+				xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
 				goto error_return;
+			}
+			if (softlimit > 0ULL && count >= softlimit) {
+				if  ((timer != 0 && get_seconds() > timer) ||
+				     (warns != 0 && warns >= warnlimit)) {
+					xfs_quota_warn(mp, dqp,
+						       QUOTA_NL_ISOFTLONGWARN);
+					goto error_return;
+				}
+				xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
+			}
 		}
 	}
 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v2] xfs: implement quota warnings via netlink
  2010-01-17 22:36   ` [PATCH 3/3 v2] " Christoph Hellwig
@ 2010-01-18 11:03     ` Dave Chinner
  0 siblings, 0 replies; 11+ messages in thread
From: Dave Chinner @ 2010-01-18 11:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Sun, Jan 17, 2010 at 05:36:19PM -0500, Christoph Hellwig wrote:
> Wire up quota_send_warning to send quota warnings over netlink.  This is
> used by various desktops to show user quota warnings.
> 
> Tested by running the quota_nld daemon while running the xfstest quota
> tests and observing the warnings.  I'll see how I can get a more formal
> testcase for it written.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Dave Chinner <david@fromorbit.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] 11+ messages in thread

end of thread, other threads:[~2010-01-18 11:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 22:05 [PATCH 0/3] small quota updates for 2.6.34 Christoph Hellwig
2010-01-13 22:05 ` [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC Christoph Hellwig
2010-01-14  0:47   ` Dave Chinner
2010-01-14 18:59   ` Alex Elder
2010-01-13 22:05 ` [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv Christoph Hellwig
2010-01-14  0:53   ` Dave Chinner
2010-01-13 22:05 ` [PATCH 3/3] xfs: implement quota warnings via netlink Christoph Hellwig
2010-01-14  1:19   ` Dave Chinner
2010-01-14  6:42     ` Christoph Hellwig
2010-01-17 22:36   ` [PATCH 3/3 v2] " Christoph Hellwig
2010-01-18 11:03     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox