linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit
@ 2018-06-22  8:44 Kazuya Mio
  2018-06-22 19:29 ` Darrick J. Wong
  2018-07-26  0:15 ` Eric Sandeen
  0 siblings, 2 replies; 3+ messages in thread
From: Kazuya Mio @ 2018-06-22  8:44 UTC (permalink / raw)
  To: Darrick J. Wong, linux-xfs@vger.kernel.org

To set/check/clear a project quota, xfs_quota performs a pre-order tree
traversal by using nftw(3).  The documentation states that the -d option
can be used to skip subtrees below a certain level in the directory
hierarchy.  Unfortunately, {check,setup,clear}_project returns -1 when
DEPTH is hit, which stops the directory tree walk immediately.  We only
wanted to skip the subtree, so return 0 instead.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
---
 quota/project.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/quota/project.c b/quota/project.c
index e4e7a01..20bc01b 100644
--- a/quota/project.c
+++ b/quota/project.c
@@ -101,7 +101,7 @@ check_project(
 	int			fd;
 
 	if (recurse_depth >= 0 && data->level > recurse_depth)
-		return -1;
+		return 0;
 
 	if (flag == FTW_NS ){
 		exitcode = 1;
@@ -146,7 +146,7 @@ clear_project(
 	int			fd;
 
 	if (recurse_depth >= 0 && data->level > recurse_depth)
-		return -1;
+		return 0;
 
 	if (flag == FTW_NS ){
 		exitcode = 1;
@@ -193,7 +193,7 @@ setup_project(
 	int			fd;
 
 	if (recurse_depth >= 0 && data->level > recurse_depth)
-		return -1;
+		return 0;
 
 	if (flag == FTW_NS ){
 		exitcode = 1;



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

* Re: [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit
  2018-06-22  8:44 [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit Kazuya Mio
@ 2018-06-22 19:29 ` Darrick J. Wong
  2018-07-26  0:15 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-06-22 19:29 UTC (permalink / raw)
  To: Kazuya Mio; +Cc: linux-xfs@vger.kernel.org

On Fri, Jun 22, 2018 at 08:44:21AM +0000, Kazuya Mio wrote:
> To set/check/clear a project quota, xfs_quota performs a pre-order tree
> traversal by using nftw(3).  The documentation states that the -d option
> can be used to skip subtrees below a certain level in the directory
> hierarchy.  Unfortunately, {check,setup,clear}_project returns -1 when
> DEPTH is hit, which stops the directory tree walk immediately.  We only
> wanted to skip the subtree, so return 0 instead.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  quota/project.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> diff --git a/quota/project.c b/quota/project.c
> index e4e7a01..20bc01b 100644
> --- a/quota/project.c
> +++ b/quota/project.c
> @@ -101,7 +101,7 @@ check_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> @@ -146,7 +146,7 @@ clear_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> @@ -193,7 +193,7 @@ setup_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit
  2018-06-22  8:44 [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit Kazuya Mio
  2018-06-22 19:29 ` Darrick J. Wong
@ 2018-07-26  0:15 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2018-07-26  0:15 UTC (permalink / raw)
  To: Kazuya Mio, Darrick J. Wong, linux-xfs@vger.kernel.org

On 6/22/18 1:44 AM, Kazuya Mio wrote:
> To set/check/clear a project quota, xfs_quota performs a pre-order tree
> traversal by using nftw(3).  The documentation states that the -d option
> can be used to skip subtrees below a certain level in the directory
> hierarchy.  Unfortunately, {check,setup,clear}_project returns -1 when
> DEPTH is hit, which stops the directory tree walk immediately.  We only
> wanted to skip the subtree, so return 0 instead.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

Getting this merged now, but an xfstests would be really, really good
to validate this behavior.  (hint, hint).

Thanks,
-Eric

> ---
>  quota/project.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> diff --git a/quota/project.c b/quota/project.c
> index e4e7a01..20bc01b 100644
> --- a/quota/project.c
> +++ b/quota/project.c
> @@ -101,7 +101,7 @@ check_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> @@ -146,7 +146,7 @@ clear_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> @@ -193,7 +193,7 @@ setup_project(
>  	int			fd;
>  
>  	if (recurse_depth >= 0 && data->level > recurse_depth)
> -		return -1;
> +		return 0;
>  
>  	if (flag == FTW_NS ){
>  		exitcode = 1;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

end of thread, other threads:[~2018-07-26  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-22  8:44 [PATCH v2] xfs_quota: don't stop the directory tree walk when DEPTH is hit Kazuya Mio
2018-06-22 19:29 ` Darrick J. Wong
2018-07-26  0:15 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).